Skip to content

Commit c21c27e

Browse files
Darrick J. Wonggregkh
authored andcommitted
xfs: always warn about deprecated mount options
[ Upstream commit 630785bfbe12c3ee3ebccd8b530a98d632b7e39d ] 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]> [ Update existing xfs_fs_warn_deprecated() callers ] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent aa05a04 commit c21c27e

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

fs/xfs/xfs_super.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,16 +1386,25 @@ suffix_kstrtoull(
13861386
static inline void
13871387
xfs_fs_warn_deprecated(
13881388
struct fs_context *fc,
1389-
struct fs_parameter *param,
1390-
uint64_t flag,
1391-
bool value)
1389+
struct fs_parameter *param)
13921390
{
1393-
/* Don't print the warning if reconfiguring and current mount point
1394-
* already had the flag set
1391+
/*
1392+
* Always warn about someone passing in a deprecated mount option.
1393+
* Previously we wouldn't print the warning if we were reconfiguring
1394+
* and current mount point already had the flag set, but that was not
1395+
* the right thing to do.
1396+
*
1397+
* Many distributions mount the root filesystem with no options in the
1398+
* initramfs and rely on mount -a to remount the root fs with the
1399+
* options in fstab. However, the old behavior meant that there would
1400+
* never be a warning about deprecated mount options for the root fs in
1401+
* /etc/fstab. On a single-fs system, that means no warning at all.
1402+
*
1403+
* Compounding this problem are distribution scripts that copy
1404+
* /proc/mounts to fstab, which means that we can't remove mount
1405+
* options unless we're 100% sure they have only ever been advertised
1406+
* in /proc/mounts in response to explicitly provided mount options.
13951407
*/
1396-
if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) &&
1397-
!!(XFS_M(fc->root->d_sb)->m_features & flag) == value)
1398-
return;
13991408
xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key);
14001409
}
14011410

@@ -1543,19 +1552,19 @@ xfs_fs_parse_param(
15431552
#endif
15441553
/* Following mount options will be removed in September 2025 */
15451554
case Opt_ikeep:
1546-
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_IKEEP, true);
1555+
xfs_fs_warn_deprecated(fc, param);
15471556
parsing_mp->m_features |= XFS_FEAT_IKEEP;
15481557
return 0;
15491558
case Opt_noikeep:
1550-
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_IKEEP, false);
1559+
xfs_fs_warn_deprecated(fc, param);
15511560
parsing_mp->m_features &= ~XFS_FEAT_IKEEP;
15521561
return 0;
15531562
case Opt_attr2:
1554-
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_ATTR2, true);
1563+
xfs_fs_warn_deprecated(fc, param);
15551564
parsing_mp->m_features |= XFS_FEAT_ATTR2;
15561565
return 0;
15571566
case Opt_noattr2:
1558-
xfs_fs_warn_deprecated(fc, param, XFS_FEAT_NOATTR2, true);
1567+
xfs_fs_warn_deprecated(fc, param);
15591568
parsing_mp->m_features |= XFS_FEAT_NOATTR2;
15601569
return 0;
15611570
case Opt_max_open_zones:

0 commit comments

Comments
 (0)