mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: don't drop inode32 on a remount without inode32 or inode64
@ 2026-11-30  0:19 Yifan Feng
  2026-11-30 13:45 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Yifan Feng @ 2026-11-30  0:19 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Ian Kent, Christian Brauner, linux-xfs, linux-kernel, Yifan Feng

xfs_fs_reconfigure() compares the mounted state with the options of
the remount, and those start out as inode64.  So a remount that names
neither inode32 nor inode64 switches an inode32 mount to inode64, and
new inodes get numbers above 32 bits:

  # mount -o inode32 /dev/vda /mnt
  # mount -o remount,noatime /dev/vda /mnt
  # grep /mnt /proc/mounts
  /dev/vda /mnt xfs rw,noatime,inode64,logbufs=8,logbsize=32k,noquota 0 0

mount(8) hides this when it is given the mount point only, because it
then passes the current options again.  Before the conversion to the
mount API the setting changed only when one of the two options was
given.

Start the options of a remount from the setting in use.

Fixes: 73e5fff98b64 ("xfs: switch to use the new mount-api")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
Tested in QEMU on a 4 TB filesystem with mount(2) and with fspick()/fsconfig(). fstests -g quick plus 178 tests that remount give the same results with and without the patch (XFS_DEBUG, xfsprogs 6.1.0).
Found and written with the help of an AI coding assistant.

 fs/xfs/xfs_super.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 2f6999b6947e..bdab50bce3c9 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -2319,6 +2319,11 @@ xfs_init_fs_context(
 	mp->m_allocsize_log = 16; /* 64k */
 	mp->m_read_bounce = XFS_READ_BOUNCE_LAZY;
 
+	/* A remount without inode32 or inode64 keeps what is in use. */
+	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE &&
+	    xfs_has_small_inums(XFS_M(fc->root->d_sb)))
+		mp->m_features |= XFS_FEAT_SMALL_INUMS;
+
 	xfs_hooks_init(&mp->m_dir_update_hooks);
 
 	fc->s_fs_info = mp;

base-commit: 822ba3a89c7896b26e4beb70e2ebffb881924dfe
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30  0:19 [PATCH] xfs: don't drop inode32 on a remount without inode32 or inode64 Yifan Feng
2026-11-30 13:45 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®