summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-12-09 19:26:22 +0100
committerJosef Bacik <josef@redhat.com>2011-12-15 17:04:23 +0100
commit7041ee97281c30a78658904140c7bd9373a36142 (patch)
tree7e0426127ca6cbe1c78e3def77b85488c69193ca
parentBtrfs: fix how we do delalloc reservations and how we free reservations on error (diff)
downloadlinux-7041ee97281c30a78658904140c7bd9373a36142.tar.xz
linux-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;
}
}