summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-12-09 13:26:22 -0500
committerJosef Bacik <josef@redhat.com>2011-12-15 11:04:23 -0500
commit7041ee97281c30a78658904140c7bd9373a36142 (patch)
tree7e0426127ca6cbe1c78e3def77b85488c69193ca
parent660d3f6cde552323578b85fc5a09a6742f1fe804 (diff)
downloadlinux-stable-7041ee97281c30a78658904140c7bd9373a36142.tar.gz
linux-stable-7041ee97281c30a78658904140c7bd9373a36142.tar.bz2
linux-stable-7041ee97281c30a78658904140c7bd9373a36142.zip
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>
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8938174e6bc1..6349c63a4b37 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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;
}
}