Skip to content

Commit 8fb2f53

Browse files
Darrick J. Wonggregkh
authored andcommitted
xfs: always warn about deprecated mount options
[ Upstream commit 630785b ] The deprecation of the 'attr2' mount option in 6.18 wasn't entirely successful because nobody noticed that the kernel never printed a warning about attr2 being set in fstab if the only xfs filesystem is the root fs; the initramfs mounts the root fs with no mount options; and the init scripts only conveyed the fstab options by remounting the root fs. Fix this by making it complain all the time. Cc: [email protected] # v5.13 Fixes: 92cf7d3 ("xfs: Skip repetitive warnings about mount options") Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]> [ adapted m_features field reference to m_flags ] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0791e68 commit 8fb2f53

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

fs/xfs/xfs_super.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,16 +1162,25 @@ suffix_kstrtoint(
11621162
static inline void
11631163
xfs_fs_warn_deprecated(
11641164
struct fs_context *fc,
1165-
struct fs_parameter *param,
1166-
uint64_t flag,
1167-
bool value)
1165+
struct fs_parameter *param)
11681166
{
1169-
/* Don't print the warning if reconfiguring and current mount point
1170-
* already had the flag set
1167+
/*
1168+
* Always warn about someone passing in a deprecated mount option.
1169+
* Previously we wouldn't print the warning if we were reconfiguring
1170+
* and current mount point already had the flag set, but that was not
1171+
* the right thing to do.
1172+
*
1173+
* Many distributions mount the root filesystem with no options in the
1174+
* initramfs and rely on mount -a to remount the root fs with the
1175+
* options in fstab. However, the old behavior meant that there would
1176+
* never be a warning about deprecated mount options for the root fs in
1177+
* /etc/fstab. On a single-fs system, that means no warning at all.
1178+
*
1179+
* Compounding this problem are distribution scripts that copy
1180+
* /proc/mounts to fstab, which means that we can't remove mount
1181+
* options unless we're 100% sure they have only ever been advertised
1182+
* in /proc/mounts in response to explicitly provided mount options.
11711183
*/
1172-
if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) &&
1173-
!!(XFS_M(fc->root->d_sb)->m_flags & flag) == value)
1174-
return;
11751184
xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key);
11761185
}
11771186

@@ -1314,19 +1323,19 @@ xfs_fc_parse_param(
13141323
#endif
13151324
/* Following mount options will be removed in September 2025 */
13161325
case Opt_ikeep:
1317-
xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_IKEEP, true);
1326+
xfs_fs_warn_deprecated(fc, param);
13181327
parsing_mp->m_flags |= XFS_MOUNT_IKEEP;
13191328
return 0;
13201329
case Opt_noikeep:
1321-
xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_IKEEP, false);
1330+
xfs_fs_warn_deprecated(fc, param);
13221331
parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP;
13231332
return 0;
13241333
case Opt_attr2:
1325-
xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_ATTR2, true);
1334+
xfs_fs_warn_deprecated(fc, param);
13261335
parsing_mp->m_flags |= XFS_MOUNT_ATTR2;
13271336
return 0;
13281337
case Opt_noattr2:
1329-
xfs_fs_warn_deprecated(fc, param, XFS_MOUNT_NOATTR2, true);
1338+
xfs_fs_warn_deprecated(fc, param);
13301339
parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2;
13311340
parsing_mp->m_flags |= XFS_MOUNT_NOATTR2;
13321341
return 0;

0 commit comments

Comments
 (0)