From: Josef Bacik Date: Fri, 1 Feb 2013 20:57:47 +0000 (-0500) Subject: Btrfs: account for orphan inodes properly during cleanup X-Git-Tag: v3.12-rc1~1062^2~57^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=925396ecf251432d6d0f703a6cfd0cb9e651d936;p=kernel%2Fkernel-generic.git Btrfs: account for orphan inodes properly during cleanup Dave sent me a panic where we were doing the orphan cleanup and panic'ed trying to release our reservation from the orphan block rsv. The reason for this is because our orphan block rsv had been free'd out from underneath us because the transaction commit found that there were no orphan inodes according to its count and decided to free it. This is incorrect so make sure we inc the orphan inodes count so the accounting is all done properly. This would also cause the warning in the orphan commit code normally if you had any orphans to cleanup as they would only decrement the orphan count so you'd get a negative orphan count which could cause problems during runtime. Thanks, Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2b48d2d..2dc5973 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2502,6 +2502,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) */ set_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &BTRFS_I(inode)->runtime_flags); + atomic_inc(&root->orphan_inodes); /* if we have links, this was a truncate, lets do that */ if (inode->i_nlink) {