xfs: always warn about deprecated mount options

[ Upstream commit 630785bfbe ]

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: stable@vger.kernel.org # v5.13
Fixes: 92cf7d3638 ("xfs: Skip repetitive warnings about mount options")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
[ Update existing xfs_fs_warn_deprecated() callers ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Darrick J. Wong
2025-10-26 14:04:22 -04:00
committed by Greg Kroah-Hartman
parent 5ff5765a1f
commit 1dae549ef5

View File

@@ -1232,16 +1232,25 @@ suffix_kstrtoint(
static inline void static inline void
xfs_fs_warn_deprecated( xfs_fs_warn_deprecated(
struct fs_context *fc, struct fs_context *fc,
struct fs_parameter *param, struct fs_parameter *param)
uint64_t flag,
bool value)
{ {
/* Don't print the warning if reconfiguring and current mount point /*
* already had the flag set * Always warn about someone passing in a deprecated mount option.
* Previously we wouldn't print the warning if we were reconfiguring
* and current mount point already had the flag set, but that was not
* the right thing to do.
*
* Many distributions mount the root filesystem with no options in the
* initramfs and rely on mount -a to remount the root fs with the
* options in fstab. However, the old behavior meant that there would
* never be a warning about deprecated mount options for the root fs in
* /etc/fstab. On a single-fs system, that means no warning at all.
*
* Compounding this problem are distribution scripts that copy
* /proc/mounts to fstab, which means that we can't remove mount
* options unless we're 100% sure they have only ever been advertised
* in /proc/mounts in response to explicitly provided mount options.
*/ */
if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) &&
!!(XFS_M(fc->root->d_sb)->m_features & flag) == value)
return;
xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key);
} }
@@ -1380,19 +1389,19 @@ xfs_fs_parse_param(
#endif #endif
/* Following mount options will be removed in September 2025 */ /* Following mount options will be removed in September 2025 */
case Opt_ikeep: case Opt_ikeep:
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_IKEEP, true); xfs_fs_warn_deprecated(fc, param);
parsing_mp->m_features |= XFS_FEAT_IKEEP; parsing_mp->m_features |= XFS_FEAT_IKEEP;
return 0; return 0;
case Opt_noikeep: case Opt_noikeep:
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_IKEEP, false); xfs_fs_warn_deprecated(fc, param);
parsing_mp->m_features &= ~XFS_FEAT_IKEEP; parsing_mp->m_features &= ~XFS_FEAT_IKEEP;
return 0; return 0;
case Opt_attr2: case Opt_attr2:
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_ATTR2, true); xfs_fs_warn_deprecated(fc, param);
parsing_mp->m_features |= XFS_FEAT_ATTR2; parsing_mp->m_features |= XFS_FEAT_ATTR2;
return 0; return 0;
case Opt_noattr2: case Opt_noattr2:
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_NOATTR2, true); xfs_fs_warn_deprecated(fc, param);
parsing_mp->m_features |= XFS_FEAT_NOATTR2; parsing_mp->m_features |= XFS_FEAT_NOATTR2;
return 0; return 0;
default: default: