]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: fix leaked space in truncate
authorJosef Bacik <josef@redhat.com>
Fri, 9 Dec 2011 18:26:22 +0000 (13:26 -0500)
committerChris Mason <chris.mason@oracle.com>
Fri, 16 Dec 2011 19:55:47 +0000 (14:55 -0500)
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>
(cherry picked from commit 7041ee97281c30a78658904140c7bd9373a36142)

fs/btrfs/inode.c

index 69253e650883ddf46c255cf4b1c65f076f20f27e..2211542494cbaf1eeb44071f2b4b93b6af6d5c77 100644 (file)
@@ -6576,8 +6576,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;
                        }
                }