]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: cleanup orphan reservation if truncate fails
authorJosef Bacik <jbacik@fusionio.com>
Thu, 7 Feb 2013 21:27:28 +0000 (16:27 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 18:26:35 +0000 (11:26 -0700)
commit 4a7d0f6854c4a4ad1dba00a3b128a32d39b9a742 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c

index 72fe40b57ae52d353f014c726d504627d359817b..659ea815dbf3caf5e67b4008ce91dea8cc8e9887 100644 (file)
@@ -2493,6 +2493,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++;
                }