From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_repair: coordinate parallel updates to the rt bitmap
Date: Wed, 23 Sep 2020 11:24:37 -0700 [thread overview]
Message-ID: <20200923182437.GW7955@magnolia> (raw)
From: Darrick J. Wong <darrick.wong@oracle.com>
Actually take the rt lock before updating the bitmap from multiple
threads. This fixes an infrequent corruption problem when running
generic/013 and rtinherit=1 is set on the root dir.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
repair/dinode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/repair/dinode.c b/repair/dinode.c
index 57013bf149b2..07f3f83aef8c 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -184,6 +184,7 @@ process_rt_rec(
xfs_rfsblock_t *tot,
int check_dups)
{
+ struct aglock *lock = &ag_locks[(signed)NULLAGNUMBER];
xfs_fsblock_t b, lastb;
xfs_rtblock_t ext;
int state;
@@ -245,6 +246,7 @@ _("data fork in rt ino %" PRIu64 " claims dup rt extent,"
continue;
}
+ pthread_mutex_lock(&lock->lock);
state = get_rtbmap(ext);
switch (state) {
case XR_E_FREE:
@@ -270,6 +272,7 @@ _("data fork in rt inode %" PRIu64 " found metadata block %" PRIu64 " in rt bmap
do_warn(
_("data fork in rt inode %" PRIu64 " claims used rt block %" PRIu64 "\n"),
ino, ext);
+ pthread_mutex_unlock(&lock->lock);
return 1;
case XR_E_FREE1:
default:
@@ -277,6 +280,7 @@ _("data fork in rt inode %" PRIu64 " claims used rt block %" PRIu64 "\n"),
_("illegal state %d in rt block map %" PRIu64 "\n"),
state, b);
}
+ pthread_mutex_unlock(&lock->lock);
}
/*
next reply other threads:[~2020-09-23 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 18:24 Darrick J. Wong [this message]
2020-09-24 5:40 ` [PATCH] xfs_repair: coordinate parallel updates to the rt bitmap Christoph Hellwig
2020-09-24 6:00 ` Darrick J. Wong
2020-09-24 6:19 ` Christoph Hellwig
2020-09-24 15:06 ` Darrick J. Wong
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=20200923182437.GW7955@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.