public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs: pass flags to second superblock
@ 2024-11-14  4:47 Li Lingfeng
  2024-11-25 22:34 ` Anna Schumaker
  0 siblings, 1 reply; 3+ messages in thread
From: Li Lingfeng @ 2024-11-14  4:47 UTC (permalink / raw)
  To: trondmy, anna
  Cc: trond.myklebust, jlayton, linux-nfs, linux-kernel, yukuai1,
	houtao1, yi.zhang, yangerkun, lilingfeng, lilingfeng3

During the process of mounting an NFSv4 client, two superblocks will be
created in sequence. The first superblock corresponds to the root
directory exported by the server, and the second superblock corresponds to
the directory that will be actually mounted. The first superblock will
eventually be destroyed.
The flag passed from user mode will only be passed to the first
superblock, resulting in the actual used superblock not carrying the flag
passed from user mode(fs_context_for_submount() will set sb_flags as 0).

Since the superblock of NFS does not carry the ro tag, the file system
status displayed by /proc/self/mountstats shows that NFS is always in the
rw state, which may mislead users.

Pass sb_flags of the fc which carry flags passed by user to second
superblock to fix it.

Fixes: 281cad46b34d ("NFS: Create a submount rpc_op")
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
---
 fs/nfs/nfs4super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index b29a26923ce0..9a3b73a33fbf 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -233,6 +233,7 @@ static int do_nfs4_mount(struct nfs_server *server,
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 
+	dentry->d_sb->s_flags = fc->sb_flags;
 	fc->root = dentry;
 	return 0;
 }
-- 
2.31.1


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

end of thread, other threads:[~2024-11-28 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14  4:47 [PATCH] nfs: pass flags to second superblock Li Lingfeng
2024-11-25 22:34 ` Anna Schumaker
2024-11-28 14:17   ` Li Lingfeng

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