From: Eric Sandeen <sandeen@sandeen.net>
To: Dave Chinner <david@fromorbit.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/7] repair: don't dirty inodes which are not unlinked
Date: Tue, 30 Oct 2018 15:09:56 -0500 [thread overview]
Message-ID: <a2aa0727-21db-fd2a-6207-0b70d05a7374@sandeen.net> (raw)
In-Reply-To: <539a02d8-f9fd-e9b4-d928-dcdced642376@sandeen.net>
So I'm not stealing commits: ;)
===
repair: don't dirty inodes unconditionally when testing unlinked state
From: Dave Chinner <dchinner@redhat.com>
I noticed phase 4 writing back lots of inode buffers during recent
testing. The recent rework of clear_inode() in commit 0724d0f4cb53
("xfs_repair: clear_dinode should simply clear, not check contents")
accidentally caught a call to clear_inode_unlinked() as well,
resulting in all inodes being marked dirty whether then needed
updating or not.
Fix it by making clear_inode_unlinked unconditionally do the clear
(as was done for clear_inode), and move the test to the caller.
Add warnings as well so that this corruption is no longer silently
fixed.
Reported-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen: rework so clear_inode_unlinked is unconditional]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
diff --git a/repair/dinode.c b/repair/dinode.c
index 379f85c..f466e77 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -125,23 +125,16 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
return;
}
-static int
+static void
clear_dinode_unlinked(xfs_mount_t *mp, xfs_dinode_t *dino)
{
- if (be32_to_cpu(dino->di_next_unlinked) != NULLAGINO) {
- if (!no_modify)
- dino->di_next_unlinked = cpu_to_be32(NULLAGINO);
- return(1);
- }
-
- return(0);
+ dino->di_next_unlinked = cpu_to_be32(NULLAGINO);
}
/*
* this clears the unlinked list too so it should not be called
* until after the agi unlinked lists are walked in phase 3.
- * returns > zero if the inode has been altered while being cleared
*/
static void
clear_dinode(xfs_mount_t *mp, xfs_dinode_t *dino, xfs_ino_t ino_num)
@@ -2675,9 +2668,16 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"),
* we're going to find. check_dups is set to 1 only during
* phase 4. Ugly.
*/
- if (check_dups && !no_modify) {
- clear_dinode_unlinked(mp, dino);
- *dirty += 1;
+ if (check_dups && be32_to_cpu(dino->di_next_unlinked) != NULLAGINO) {
+ if (no_modify) {
+ do_warn(
+ _("Would clear next_unlinked in inode %" PRIu64 "\n"), lino);
+ } else {
+ clear_dinode_unlinked(mp, dino);
+ do_warn(
+ _("Cleared next_unlinked in inode %" PRIu64 "\n"), lino);
+ *dirty += 1;
+ }
}
/* set type and map type info */
next prev parent reply other threads:[~2018-10-31 5:04 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 11:20 [PATCH 0/7] xfs_repair: scale to 150,000 iops Dave Chinner
2018-10-30 11:20 ` [PATCH 1/7] Revert "xfs_repair: treat zero da btree pointers as corruption" Dave Chinner
2018-10-30 17:20 ` Darrick J. Wong
2018-10-30 19:35 ` Eric Sandeen
2018-10-30 20:11 ` Dave Chinner
2018-10-30 11:20 ` [PATCH 2/7] repair: don't dirty inodes which are not unlinked Dave Chinner
2018-10-30 17:26 ` Darrick J. Wong
2018-10-30 20:03 ` Eric Sandeen
2018-10-30 20:09 ` Eric Sandeen [this message]
2018-10-30 20:34 ` Dave Chinner
2018-10-30 20:40 ` Eric Sandeen
2018-10-30 20:58 ` Dave Chinner
2018-10-30 11:20 ` [PATCH 3/7] cache: prevent expansion races Dave Chinner
2018-10-30 17:39 ` Darrick J. Wong
2018-10-30 20:35 ` Dave Chinner
2018-10-31 17:13 ` Brian Foster
2018-11-01 1:27 ` Dave Chinner
2018-11-01 13:17 ` Brian Foster
2018-11-01 21:23 ` Dave Chinner
2018-11-02 11:31 ` Brian Foster
2018-11-02 23:26 ` Dave Chinner
2018-10-30 11:20 ` [PATCH 4/7] workqueue: bound maximum queue depth Dave Chinner
2018-10-30 17:58 ` Darrick J. Wong
2018-10-30 20:53 ` Dave Chinner
2018-10-31 17:14 ` Brian Foster
2018-10-30 11:20 ` [PATCH 5/7] repair: Protect bad inode list with mutex Dave Chinner
2018-10-30 17:44 ` Darrick J. Wong
2018-10-30 20:54 ` Dave Chinner
2018-10-30 11:20 ` [PATCH 6/7] repair: protect inode chunk tree records with a mutex Dave Chinner
2018-10-30 17:46 ` Darrick J. Wong
2018-10-30 11:20 ` [PATCH 7/7] repair: parallelise phase 6 Dave Chinner
2018-10-30 17:51 ` Darrick J. Wong
2018-10-30 20:55 ` Dave Chinner
2018-11-07 5:44 ` [PATCH 0/7] xfs_repair: scale to 150,000 iops Arkadiusz Miśkiewicz
2018-11-07 6:48 ` Dave Chinner
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=a2aa0727-21db-fd2a-6207-0b70d05a7374@sandeen.net \
--to=sandeen@sandeen.net \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/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).