From: Darrick J. Wong Date: Wed, 22 Jun 2022 19:28:52 +0000 (-0500) Subject: xfs: do not use logged xattr updates on V4 filesystems X-Git-Tag: v5.19.0-rc0~14 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=433bc15b8be5b69642daba768a0fe06ae436d64a;p=thirdparty%2Fxfsprogs-dev.git xfs: do not use logged xattr updates on V4 filesystems Source kernel commit: 22a68ba724232ba675166c307ddef3749ae4c37c V4 superblocks do not contain the log_incompat feature bit, which means that we cannot protect xattr log items against kernels that are too old to know how to recover them. Turn off the log items for such filesystems and adjust the "delayed" name to reflect what it's really controlling. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 351391e4d..154ec886d 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -980,7 +980,7 @@ xfs_attr_set( int error, local; int rmt_blks = 0; unsigned int total; - int delayed = xfs_has_larp(mp); + bool use_logging = xfs_has_larp(mp); if (xfs_is_shutdown(dp->i_mount)) return -EIO; @@ -1025,7 +1025,7 @@ xfs_attr_set( rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX); } - if (delayed) { + if (use_logging) { error = xfs_attr_use_log_assist(mp); if (error) return error; @@ -1099,7 +1099,7 @@ xfs_attr_set( out_unlock: xfs_iunlock(dp, XFS_ILOCK_EXCL); drop_incompat: - if (delayed) + if (use_logging) xlog_drop_incompat_feat(mp->m_log); return error; diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index b88b6d74e..3cd9cbb68 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -31,7 +31,8 @@ struct xfs_attr_list_context; static inline bool xfs_has_larp(struct xfs_mount *mp) { #ifdef DEBUG - return xfs_globals.larp; + /* Logged xattrs require a V5 super for log_incompat */ + return xfs_has_crc(mp) && xfs_globals.larp; #else return false; #endif