Skip to content

Commit

Permalink
Btrfs: use set_nlink if our i_nlink is 0
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Josef Bacik committed Mar 4, 2013
1 parent d7011f5 commit 9bf7a48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9bf7a48

Please sign in to comment.