Skip to content

Commit

Permalink
Btrfs: don't delay inode ref updates during log replay
Browse files Browse the repository at this point in the history
Commit 1d52c78 (Btrfs: try not to ENOSPC on log replay) added a
check to skip delayed inode updates during log replay because it
confuses the enospc code.  But the delayed processing will end up
ignoring delayed refs from log replay because the inode itself wasn't
put through the delayed code.

This can end up triggering a warning at commit time:

WARNING: CPU: 2 PID: 778 at fs/btrfs/delayed-inode.c:1410 btrfs_assert_delayed_root_empty+0x32/0x34()

Which is repeated for each commit because we never process the delayed
inode ref update.

The fix used here is to change btrfs_delayed_delete_inode_ref to return
an error if we're currently in log replay.  The caller will do the ref
deletion immediately and everything will work properly.

Signed-off-by: Chris Mason <[email protected]>
cc: [email protected] # v3.18 and any stable series that picked 1d52c78
  • Loading branch information
masoncl committed Jan 2, 2015
1 parent a1317f4 commit 6f89605
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/btrfs/delayed-inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,14 @@ int btrfs_delayed_delete_inode_ref(struct inode *inode)
{
struct btrfs_delayed_node *delayed_node;

/*
* we don't do delayed inode updates during log recovery because it
* leads to enospc problems. This means we also can't do
* delayed inode refs
*/
if (BTRFS_I(inode)->root->fs_info->log_root_recovering)
return -EAGAIN;

delayed_node = btrfs_get_or_create_delayed_node(inode);
if (IS_ERR(delayed_node))
return PTR_ERR(delayed_node);
Expand Down

0 comments on commit 6f89605

Please sign in to comment.