Skip to contentSkip to conversation

NFSv4: Fix the sync mount option for nfs4 mounts

PATCH In review Scott Mayhew 2 participants 2 messages Jul 31, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4: Fix the sync mount option for nfs4 mounts

The sync mount option stopped working for NFSv4 mounts after commit c02d7adf8c5429727a98bad1d039bccad4c61c50 (NFSv4: Replace nfs4_path_walk() with FS path lookup in a private namespace). If MS_SYNCHRONOUS is set in the super_block that we're cloning from, then it should be set in the new super_block as well.

---
 fs/nfs/super.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/nfs/super.c +4 -0
index 71fdc0d..f6db66d 100644
@@ -2478,6 +2478,10 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
 	if (server->flags & NFS_MOUNT_NOAC)
 		sb_mntdata.mntflags |= MS_SYNCHRONOUS;
 
+	if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)
+		if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS)
+			sb_mntdata.mntflags |= MS_SYNCHRONOUS;
+
 	/* Get a superblock - note that we may end up sharing one that already exists */
 	s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata);
 	if (IS_ERR(s)) {
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 16 lines · On Wed, 31 Jul 2013 10:01:41 -0400 Scott Mayhew <[email protected]> wrote:

The sync mount option stopped working for NFSv4 mounts after commit c02d7adf8c5429727a98bad1d039bccad4c61c50 (NFSv4: Replace nfs4_path_walk() with FS path lookup in a private namespace). If MS_SYNCHRONOUS is set in the super_block that we're cloning from, then it should be set in the new super_block as well.

---
 fs/nfs/super.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/nfs/super.c +0 -0
index 71fdc0d..f6db66d 100644

fs/nfs/super.c struct dentry *nfs_fs_mount_common(struct nfs_server *server, · line 2487

Quoted 10 lines
fs/nfs/super.c +4 -0
@@ -2478,6 +2478,10 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
 	if (server->flags & NFS_MOUNT_NOAC)
 		sb_mntdata.mntflags |= MS_SYNCHRONOUS;
 
+	if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)
+		if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS)
+			sb_mntdata.mntflags |= MS_SYNCHRONOUS;
+
 	/* Get a superblock - note that we may end up sharing one that already exists */
 	s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata);
 	if (IS_ERR(s)) {

Might also consider this for stable, since it's a regression, though it is a relatively minor bug...

Reviewed-and-Tested-by Jeff Layton <[email protected]>