linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: Roman Mamedov <rm@romanrm.net>, Marc MERLIN <marc@merlins.org>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs: don't delay inode ref updates during log replay
Date: Wed, 31 Dec 2014 13:30:13 -0500	[thread overview]
Message-ID: <20141231183013.GA3637@ret.masoncoding.com> (raw)
In-Reply-To: <54A1FAB2.2050805@cn.fujitsu.com>

Commit 1d52c78afbb (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
skipping 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 ref.

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

This bug can cause lost files, whick fsck will find.  --repair on
btrfs-progs 3.18 will fix them

Signed-off-by: Chris Mason <clm@fb.com>
cc: stable@vger.kernel.org # v3.18 and any stable series that picked 1d52c78afbbf80b58299e076a159617d6b42fe3c

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 054577b..de4e70f 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -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);

  reply	other threads:[~2014-12-31 18:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-28 19:26 3.16.3: fs/btrfs/delayed-inode.c:1410 btrfs_assert_delayed_root_empty Marc MERLIN
2014-12-28 20:00 ` Roman Mamedov
2014-12-28 21:36   ` Marc MERLIN
2014-12-29 15:17     ` Chris Mason
2014-12-29 15:41       ` Marc MERLIN
2014-12-29 15:57         ` Chris Mason
2014-12-30  1:06   ` Qu Wenruo
2014-12-31 18:30     ` Chris Mason [this message]
2015-01-01 22:58       ` [PATCH] Btrfs: don't delay inode ref updates during log replay Marc MERLIN
2015-01-02  0:44         ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141231183013.GA3637@ret.masoncoding.com \
    --to=clm@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marc@merlins.org \
    --cc=quwenruo@cn.fujitsu.com \
    --cc=rm@romanrm.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).