Skip to content

Commit

Permalink
Btrfs: fix leaked space in truncate
Browse files Browse the repository at this point in the history
We were occasionaly leaking space when running xfstest 269.  This is because if
we failed to start the transaction in the truncate loop we'd just goto out, but
we need to break so that the inode is removed from the orphan list and the space
is properly freed.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed Dec 15, 2011
1 parent 660d3f6 commit 7041ee9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6566,8 +6566,9 @@ static int btrfs_truncate(struct inode *inode)
/* Just need the 1 for updating the inode */
trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);
goto out;
ret = err = PTR_ERR(trans);
trans = NULL;
break;
}
}

Expand Down

0 comments on commit 7041ee9

Please sign in to comment.