mbox series

[PATCHSET,0/3] xfs: fix ro mounting with unknown rocompat features

Message ID 169291929524.220104.3844042018007786965.stgit@frogsfrogsfrogs (mailing list archive)
Headers show
Series xfs: fix ro mounting with unknown rocompat features | expand

Message

Darrick J. Wong Aug. 24, 2023, 11:21 p.m. UTC
Hi all,

Dave pointed out some failures in xfs/270 when he upgraded Debian
unstable and util-linux started using the new mount apis.  Upon further
inquiry I noticed that XFS is quite a hot mess when it encounters a
filesystem with unrecognized rocompat bits set in the superblock.

Whereas we used to allow readonly mounts under these conditions, a
change to the sb write verifier several years ago resulted in the
filesystem going down immediately because the post-mount log cleaning
writes the superblock, which trips the sb write verifier on the
unrecognized rocompat bit.  I made the observation that the ROCOMPAT
features RMAPBT and REFLINK both protect new log intent item types,
which means that we actually cannot support recovering the log if we
don't recognize all the rocompat bits.

Therefore -- fix inode inactivation to work when we're recovering the
log, disallow recovery when there's unrecognized rocompat bits, and
don't clean the log if doing so would trip the rocompat checks.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been lightly tested with fstests.  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=fix-ro-mounts-6.6
---
 fs/xfs/xfs_inode.c       |   14 ++++++++++----
 fs/xfs/xfs_log.c         |   23 ++++++-----------------
 fs/xfs/xfs_log_priv.h    |    7 +++++++
 fs/xfs/xfs_log_recover.c |   32 ++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 21 deletions(-)