From: Josef Bacik Date: Thu, 7 Feb 2013 21:27:28 +0000 (-0500) Subject: Btrfs: cleanup orphan reservation if truncate fails X-Git-Tag: v3.8.3~26 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5cb065d3405ac7549caedccd92e7e51adce916bd;p=users%2Fjedix%2Flinux-maple.git Btrfs: cleanup orphan reservation if truncate fails 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 72fe40b57ae5..659ea815dbf3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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++; }