Unverified Commit 2ddb67ab authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15411 v2 Ignore SB_RDONLY when mounting and remounting nfs

Merge Pull Request from: @ci-robot 
 
PR sync from: Li Lingfeng <lilingfeng3@huawei.com>
https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/ZLEXRJSZCFU6YYEWJWQ5CUFFOYGNQ34K/ 
When NFS_MOUNT_UNSHARED is not set, NFS forces the sharing of a
superblock among each filesystem that mounts sub-directories elonging to
a single exported root path.

To prevent interference between different filesystems, ignore SB_RDONLY
when mounting and remounting nfs.

Li Lingfeng (2):
  nfs: clear SB_RDONLY before getting superblock
  nfs: ignore SB_RDONLY when remounting nfs

---
Changes in v2:
- Change the bugzilla tag to the gitee link.
---

 
https://gitee.com/openeuler/kernel/issues/IB42W1 
 
Link:https://gitee.com/openeuler/kernel/pulls/15411

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parents 79b6d4a5 0caa2bf1
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -2309,6 +2309,16 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)

	sync_filesystem(sb);

	/*
	 * The SB_RDONLY flag has been removed from the superblock during
	 * mounts to prevent interference between different filesystems.
	 * Similarly, it is also necessary to ignore the SB_RDONLY flag
	 * during reconfiguration; otherwise, it may also result in the
	 * creation of redundant superblocks when mounting a directory with
	 * different rw and ro flags multiple times.
	 */
	*flags &= ~SB_RDONLY;

	/*
	 * Userspace mount programs that send binary options generally send
	 * them populated with default values. We have no way to know which
@@ -2649,8 +2659,17 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
	};
	int error;

	/*
	 * When NFS_MOUNT_UNSHARED is not set, NFS forces the sharing of a
	 * superblock among each filesystem that mounts sub-directories
	 * belonging to a single exported root path.
	 * To prevent interference between different filesystems, the
	 * SB_RDONLY flag should be removed from the superblock.
	 */
	if (server->flags & NFS_MOUNT_UNSHARED)
		compare_super = NULL;
	else
		sb_mntdata.mntflags &= ~SB_RDONLY;

	/* -o noac implies -o sync */
	if (server->flags & NFS_MOUNT_NOAC)