summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-03-01 13:35:47 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-03-04 16:30:06 -0500
commit9bf7a4890518186238d2579be16ecc5190a707c0 (patch)
treece4ca80d9aa36046dc671365950819adbae861fa
parentd7011f5b9dd3c88feb5cebad7d0b719ed6816ebd (diff)
downloadlinux-9bf7a4890518186238d2579be16ecc5190a707c0.tar.gz
linux-9bf7a4890518186238d2579be16ecc5190a707c0.tar.bz2
linux-9bf7a4890518186238d2579be16ecc5190a707c0.zip
Btrfs: use set_nlink if our i_nlink is 0
We need to inc the nlink of deleted entries when running replay so we can do the unlink on the fs_root and get everything cleaned up and then have the orphan cleanup do the right thing. The problem is inc_nlink complains about this, even thought it still does the right thing. So use set_nlink() if our i_nlink is 0 to keep users from seeing the warnings during log replay. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r--fs/btrfs/tree-log.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c7ef569eb22a..451fad96ecd1 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1382,7 +1382,10 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
if (ret == 0) {
- btrfs_inc_nlink(inode);
+ if (!inode->i_nlink)
+ set_nlink(inode, 1);
+ else
+ btrfs_inc_nlink(inode);
ret = btrfs_update_inode(trans, root, inode);
} else if (ret == -EEXIST) {
ret = 0;