From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: Dave Chinner <dchinner@redhat.com>,
linux-xfs@vger.kernel.org, david@fromorbit.com,
wen.gang.wang@oracle.com
Subject: [PATCHSET V2 for-5.16 0/2] xfs: fix data corruption when cycling ro/rw mounts
Date: Wed, 08 Dec 2021 15:15:04 -0800 [thread overview]
Message-ID: <163900530491.374528.3847809977076817523.stgit@magnolia> (raw)
Hi all,
As part of a large customer escalation, I've been combing through the
XFS copy on write code to try to find sources of (mostly) silent data
corruption. I found a nasty problem in the remount code, wherein a ro
remount can race with file reader threads and fail to clean out cached
inode COW forks. A subsequent rw remount calls the COW staging extent
recovery code, which frees the space but does not update the records in
the cached inode COW forks. This leads to massive fs corruption.
The first patch in this series is the critical fix for the race
condition. The second patch is defensive in that it moves the COW
staging extent recovery so that it always happens at mount time to
protect us against future screwups.
v2: rework comments, move xfs_reflink_recover_cow to xfs_log_mount_finish
If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy!
Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=remount-fixes-5.16
---
fs/xfs/xfs_log.c | 23 ++++++++++++++++++++++-
fs/xfs/xfs_mount.c | 10 ----------
fs/xfs/xfs_reflink.c | 5 ++++-
fs/xfs/xfs_super.c | 23 +++++++++++------------
4 files changed, 37 insertions(+), 24 deletions(-)
next reply other threads:[~2021-12-08 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 23:15 Darrick J. Wong [this message]
2021-12-08 23:15 ` [PATCH 1/2] xfs: remove all COW fork extents when remounting readonly Darrick J. Wong
2021-12-09 13:44 ` Chandan Babu R
2021-12-08 23:15 ` [PATCH 2/2] xfs: only run COW extent recovery when there are no live extents Darrick J. Wong
2021-12-09 5:41 ` Dave Chinner
2021-12-11 1:24 ` Darrick J. Wong
2021-12-09 14:44 ` Chandan Babu R
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=163900530491.374528.3847809977076817523.stgit@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=wen.gang.wang@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox