Btrfs: fix leaked space in truncate

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>
This commit is contained in:
Josef Bacik 2011-12-09 13:26:22 -05:00
parent 660d3f6cde
commit 7041ee9728

View File

@ -6566,8 +6566,9 @@ static int btrfs_truncate(struct inode *inode)
/* Just need the 1 for updating the inode */ /* Just need the 1 for updating the inode */
trans = btrfs_start_transaction(root, 1); trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
err = PTR_ERR(trans); ret = err = PTR_ERR(trans);
goto out; trans = NULL;
break;
} }
} }