Skip to content

Commit 22a68ba

Browse files
Darrick J. Wongdchinner
authored andcommitted
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 <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent e3c5de2 commit 22a68ba

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ xfs_attr_set(
982982
int error, local;
983983
int rmt_blks = 0;
984984
unsigned int total;
985-
int delayed = xfs_has_larp(mp);
985+
bool use_logging = xfs_has_larp(mp);
986986

987987
if (xfs_is_shutdown(dp->i_mount))
988988
return -EIO;
@@ -1027,7 +1027,7 @@ xfs_attr_set(
10271027
rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
10281028
}
10291029

1030-
if (delayed) {
1030+
if (use_logging) {
10311031
error = xfs_attr_use_log_assist(mp);
10321032
if (error)
10331033
return error;
@@ -1101,7 +1101,7 @@ xfs_attr_set(
11011101
out_unlock:
11021102
xfs_iunlock(dp, XFS_ILOCK_EXCL);
11031103
drop_incompat:
1104-
if (delayed)
1104+
if (use_logging)
11051105
xlog_drop_incompat_feat(mp->m_log);
11061106
return error;
11071107

fs/xfs/libxfs/xfs_attr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ struct xfs_attr_list_context;
3131
static inline bool xfs_has_larp(struct xfs_mount *mp)
3232
{
3333
#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;
3536
#else
3637
return false;
3738
#endif

0 commit comments

Comments
 (0)