Re: [PATCH] NFS: Don't hard-code the fs_type when submounting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 20, 2020 at 08:06:20AM -0500, Scott Mayhew wrote:
> Hard-coding the fstype causes "nfs4" mounts to appear as "nfs",
> which breaks scripts that do "umount -at nfs4".
> 
> Reported-by: Patrick Steinhardt <ps@xxxxxx>
> Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
> Signed-off-by: Scott Mayhew <smayhew@xxxxxxxxxx>
> ---
>  fs/nfs/namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
> index ad6077404947..f3ece8ed3203 100644
> --- a/fs/nfs/namespace.c
> +++ b/fs/nfs/namespace.c
> @@ -153,7 +153,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
>  	/* Open a new filesystem context, transferring parameters from the
>  	 * parent superblock, including the network namespace.
>  	 */
> -	fc = fs_context_for_submount(&nfs_fs_type, path->dentry);
> +	fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
>  	if (IS_ERR(fc))
>  		return ERR_CAST(fc);

Thanks for your fix! While this fixes the fstype with mount.nfs4(8),
it still doesn't work when using mount(8):

     $ sudo mount server:/mnt /mnt && findmnt -n -ofstype /mnt
     nfs
     $ sudo umount /mnt
     $ sudo mount.nfs4 server:/mnt /mnt && findmnt -n -ofstype /mnt
     nfs4

I guess the issue is that the kernel doesn't yet know which NFS version
the server provides at the point where `fs_context_for_submount()` is
called.

Patrick

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux