All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nilfs2: keep the current mount options on remount
@ 2026-12-05  3:28 Yifan Feng
  2026-12-05 16:55 ` Ryusuke Konishi
  0 siblings, 1 reply; 2+ messages in thread
From: Yifan Feng @ 2026-12-05  3:28 UTC (permalink / raw)
  To: Ryusuke Konishi, Viacheslav Dubeyko
  Cc: Eric Sandeen, linux-nilfs, linux-kernel, Yifan Feng

nilfs_init_fs_context() fills every new context with the default
options, and nilfs_reconfigure() installs them as they are.  So a
remount that does not repeat nobarrier, errors=, order=strict and
discard resets them:

  # mount -t nilfs2 -o nobarrier,discard /dev/vda /mnt
  # findmnt -no OPTIONS /mnt
  rw,relatime,nobarrier,discard
  # mount -o remount,noatime /dev/vda /mnt
  # findmnt -no OPTIONS /mnt
  rw,noatime

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 a remount changed only the options that it named.

For a remount, start from the options in use.

Fixes: 36defdd9d7c6 ("nilfs2: convert to use the new mount API")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
On the for-next branch of nilfs2.git. Tested in QEMU with mount(2), mount(8) and fspick()/fsconfig(); with nobarrier the flush requests were counted before and after each remount.
Found and written with the help of an AI coding assistant.

 fs/nilfs2/super.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index ddad1e4f55ce..a4e17d6ee8d7 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -1286,12 +1286,18 @@ static const struct fs_context_operations nilfs_context_ops = {
 static int nilfs_init_fs_context(struct fs_context *fc)
 {
 	struct nilfs_fs_context *ctx;
+	struct the_nilfs *nilfs;
 
 	ctx = kzalloc_obj(*ctx);
 	if (!ctx)
 		return -ENOMEM;
 
-	ctx->ns_mount_opt = NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER;
+	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
+		nilfs = fc->root->d_sb->s_fs_info;
+		ctx->ns_mount_opt = nilfs->ns_mount_opt;
+	} else {
+		ctx->ns_mount_opt = NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER;
+	}
 	fc->fs_private = ctx;
 	fc->ops = &nilfs_context_ops;
 

base-commit: 499a46e4a0f0ff642d5fe2a53bb04a0de64cfe74
-- 
2.39.3 (Apple Git-146)


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

end of thread, other threads:[~2026-12-05 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  3:28 [PATCH] nilfs2: keep the current mount options on remount Yifan Feng
2026-12-05 16:55 ` Ryusuke Konishi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.