public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET 5.16-rcX 0/2] xfs: fix data corruption when cycling ro/rw mounts
@ 2021-12-07 18:35 Darrick J. Wong
  2021-12-07 18:35 ` [PATCH 1/2] xfs: remove all COW fork extents when remounting readonly Darrick J. Wong
  2021-12-07 18:35 ` [PATCH 2/2] xfs: only run COW extent recovery when there are no live extents Darrick J. Wong
  0 siblings, 2 replies; 11+ messages in thread
From: Darrick J. Wong @ 2021-12-07 18:35 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, david, wen.gang.wang

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.

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_mount.c   |   37 ++++++++++++++++++++++++++++---------
 fs/xfs/xfs_reflink.c |    4 +++-
 fs/xfs/xfs_super.c   |   23 +++++++++++------------
 3 files changed, 42 insertions(+), 22 deletions(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCHSET V2 for-5.16 0/2] xfs: fix data corruption when cycling ro/rw mounts
@ 2021-12-08 23:15 Darrick J. Wong
  2021-12-08 23:15 ` [PATCH 2/2] xfs: only run COW extent recovery when there are no live extents Darrick J. Wong
  0 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2021-12-08 23:15 UTC (permalink / raw)
  To: djwong; +Cc: Dave Chinner, linux-xfs, david, wen.gang.wang

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(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-11  1:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-07 18:35 [PATCHSET 5.16-rcX 0/2] xfs: fix data corruption when cycling ro/rw mounts Darrick J. Wong
2021-12-07 18:35 ` [PATCH 1/2] xfs: remove all COW fork extents when remounting readonly Darrick J. Wong
2021-12-07 21:33   ` Dave Chinner
2021-12-08  1:38     ` Darrick J. Wong
2021-12-07 18:35 ` [PATCH 2/2] xfs: only run COW extent recovery when there are no live extents Darrick J. Wong
2021-12-07 22:21   ` Dave Chinner
2021-12-08  1:50     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2021-12-08 23:15 [PATCHSET V2 for-5.16 0/2] xfs: fix data corruption when cycling ro/rw mounts Darrick J. Wong
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox