hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB42W1
--------------------------------
Commit 81102eb59247 ("nfs: pass flags to second superblock") directly assigns fc->sb_flags to dentry->d_sb->s_flags, which will cause the loss of the initialized flags in dentry->d_sb->s_flags.
Fix it by just passing SB_RDONLY from fc->sb_flags to dentry->d_sb->s_flags.
Fixes: 81102eb59247 ("nfs: pass flags to second superblock") Signed-off-by: Li Lingfeng lilingfeng3@huawei.com --- fs/nfs/nfs4super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 886be9cc0016..41cd3597e482 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c @@ -254,7 +254,7 @@ struct dentry *nfs4_try_mount(int flags, const char *dev_name, res = nfs_follow_remote_path(root_mnt, export_path);
if (!IS_ERR(res)) - res->d_sb->s_flags = flags; + res->d_sb->s_flags |= (flags & SB_RDONLY); dfprintk(MOUNT, "<-- nfs4_try_mount() = %d%s\n", PTR_ERR_OR_ZERO(res), IS_ERR(res) ? " [error]" : "");