Btrfs: fix leaked space in truncate
authorJosef Bacik <josef@redhat.com>
Fri, 9 Dec 2011 18:26:22 +0000 (13:26 -0500)
committerJosef Bacik <josef@redhat.com>
Thu, 15 Dec 2011 16:04:23 +0000 (11:04 -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>
fs/btrfs/inode.c

index 8938174e6bc1f32a9c046f5f972e2b3ba8163eeb..6349c63a4b37935df3c8fc7e5bd76f30c411e8e6 100644 (file)
@@ -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;
                        }
                }