Btrfs: cleanup orphan reservation if truncate fails
authorJosef Bacik <jbacik@fusionio.com>
Thu, 7 Feb 2013 21:27:28 +0000 (16:27 -0500)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 20 Feb 2013 17:59:44 +0000 (12:59 -0500)
I noticed we were getting lots of warnings with xfstest 83 because we have
reservations outstanding.  This is because we moved the orphan add outside
of the truncate, but we don't actually cleanup our reservation if something
fails.  This fixes the problem and I no longer see warnings.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/inode.c

index cf26778085e08185a7c7c03e0fd6f7a34bc7c7e4..16925807a9ed5005945b62e5d14454b84b357ab7 100644 (file)
@@ -2538,6 +2538,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
                                goto out;
 
                        ret = btrfs_truncate(inode);
+                       if (ret)
+                               btrfs_orphan_del(NULL, inode);
                } else {
                        nr_unlink++;
                }