Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: do not use logged xattr updates on V4 filesystems

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 <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Darrick J. Wong and committed by
Dave Chinner
22a68ba7 e3c5de22

+5 -4
+3 -3
fs/xfs/libxfs/xfs_attr.c
··· 982 982 int error, local; 983 983 int rmt_blks = 0; 984 984 unsigned int total; 985 - int delayed = xfs_has_larp(mp); 985 + bool use_logging = xfs_has_larp(mp); 986 986 987 987 if (xfs_is_shutdown(dp->i_mount)) 988 988 return -EIO; ··· 1027 1027 rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX); 1028 1028 } 1029 1029 1030 - if (delayed) { 1030 + if (use_logging) { 1031 1031 error = xfs_attr_use_log_assist(mp); 1032 1032 if (error) 1033 1033 return error; ··· 1101 1101 out_unlock: 1102 1102 xfs_iunlock(dp, XFS_ILOCK_EXCL); 1103 1103 drop_incompat: 1104 - if (delayed) 1104 + if (use_logging) 1105 1105 xlog_drop_incompat_feat(mp->m_log); 1106 1106 return error; 1107 1107
+2 -1
fs/xfs/libxfs/xfs_attr.h
··· 31 31 static inline bool xfs_has_larp(struct xfs_mount *mp) 32 32 { 33 33 #ifdef DEBUG 34 - return xfs_globals.larp; 34 + /* Logged xattrs require a V5 super for log_incompat */ 35 + return xfs_has_crc(mp) && xfs_globals.larp; 35 36 #else 36 37 return false; 37 38 #endif