login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
April
»
23
Re: A share can be mounted multiple times on the same mountpoint when using the option 'noac'
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Andrew Morton
Subject:
Re: A share can be mounted multiple times on the same mountpoint when using the option 'noac'
Date: Friday, April 23, 2010 - 10:25 am
(cc linux-nfs) On Fri, 23 Apr 2010 12:38:38 -0400 (EDT) Sachin Prabhu <sprabhu@redhat.com> wrote:
quoted text
> When you normally attempt to mount a share twice on the same mountpoint, a check in do_add_mount causes it to return an error > > # mount localhost:/nfsv3 /mnt > # mount localhost:/nfsv3 /mnt > mount.nfs: /mnt is already mounted or busy > > However when using the option 'noac', the user is able to mount the same share on the same mountpoint multiple times. This happens because a share mounted with the noac option is automatically assigned the 'sync' flag MS_SYNCHRONOUS in nfs_initialise_sb(). This flag is set after the check for already existing superblocks is done in sget(). The check for the mount flags in nfs_compare_mount_options() does not take into account the 'sync' flag applied later on in the code path. This means that when using 'noac', a new superblock structure is assigned for every new mount of the same share and multiple shares on the same mountpoint are allowed. > > ie. > # mount -onoac localhost:/nfsv3 /mnt > can be run multiple times. > > Could the existing behavior be considered to be a bug? If yes, one possible fix for this issue is to move the 'sync' flag assignment before the sget() is called to obtain an already existing superblock structure. > > Signed-off-by: Sachin Prabhu <sprabhu@redhat.com> > > diff -up linux-2.6/fs/nfs/super.c.noac_multiple_mount linux-2.6/fs/nfs/super.c > --- linux-2.6/fs/nfs/super.c.noac_multiple_mount 2010-04-22 17:08:25.000000000 +0100 > +++ linux-2.6/fs/nfs/super.c 2010-04-22 17:27:48.000000000 +0100 > @@ -1992,9 +1992,6 @@ static inline void nfs_initialise_sb(str > sb->s_blocksize = nfs_block_bits(server->wsize, > &sb->s_blocksize_bits); > > - if (server->flags & NFS_MOUNT_NOAC) > - sb->s_flags |= MS_SYNCHRONOUS; > - > sb->s_bdi = &server->backing_dev_info; > > nfs_super_set_maxbytes(sb, server->maxfilesize); > @@ -2202,6 +2199,9 @@ static int nfs_get_sb(struct file_system > if (server->flags & NFS_MOUNT_UNSHARED) > compare_super = NULL; > > + if (server->flags & NFS_MOUNT_NOAC) > + sb_mntdata.mntflags |= MS_SYNCHRONOUS; > + > /* Get a superblock - note that we may end up sharing one that already exists */ > s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); > if (IS_ERR(s)) { > @@ -2317,6 +2317,9 @@ static int nfs_xdev_get_sb(struct file_s > if (server->flags & NFS_MOUNT_UNSHARED) > compare_super = NULL; > > + if (server->flags & NFS_MOUNT_NOAC) > + sb_mntdata.mntflags |= MS_SYNCHRONOUS; > + > /* Get a superblock - note that we may end up sharing one that already exists */ > s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); > if (IS_ERR(s)) { > @@ -2572,6 +2575,9 @@ static int nfs4_remote_get_sb(struct fil > if (server->flags & NFS4_MOUNT_UNSHARED) > compare_super = NULL; > > + if (server->flags & NFS_MOUNT_NOAC) > + sb_mntdata.mntflags |= MS_SYNCHRONOUS; > + > /* Get a superblock - note that we may end up sharing one that already exists */ > s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); > if (IS_ERR(s)) { > @@ -2808,6 +2814,9 @@ static int nfs4_xdev_get_sb(struct file_ > if (server->flags & NFS4_MOUNT_UNSHARED) > compare_super = NULL; > > + if (server->flags & NFS_MOUNT_NOAC) > + sb_mntdata.mntflags |= MS_SYNCHRONOUS; > + > /* Get a superblock - note that we may end up sharing one that already exists */ > s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); > if (IS_ERR(s)) { > @@ -2893,6 +2902,9 @@ static int nfs4_remote_referral_get_sb(s > if (server->flags & NFS4_MOUNT_UNSHARED) > compare_super = NULL; > > + if (server->flags & NFS_MOUNT_NOAC) > + sb_mntdata.mntflags |= MS_SYNCHRONOUS; > + > /* Get a superblock - note that we may end up sharing one that already exists */ > s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata); > if (IS_ERR(s)) { > --
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
A share can be mounted multiple times on the same mountpoi ...
, Sachin Prabhu
, (Fri Apr 23, 9:38 am)
Re: A share can be mounted multiple times on the same moun ...
, Andrew Morton
, (Fri Apr 23, 10:25 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v2 11/11] sched: update tg->shares after cpu.shares write
Ingo Molnar
Re: [RFC] Cpu-hotplug: Using the Process Freezer (try2)
Michal Nazarewicz
Re: [PATCH] USB: Gadget: g_multi: added INF file for gadget with multiple configur...
Eric W. Biederman
Re: init's children list is long and slows reaping children.
Jeffrey V. Merkey
Re: Versioning file system
git
:
Matthieu Moy
Re: Bugs in Gitosis
Daniel Barkalow
Re: About git and the use of SHA-1
David Lang
Re: mingw, windows, crlf/lf, and git
Shawn O. Pearce
Re: Bugs in Gitosis
Junio C Hamano
Re: [PATCH 14/21] Convert ce_path_match() to use struct pathspec
linux-netdev
:
David Miller
Re: [2.6.30-rc3] powerpc: compilation error of mace module
David Miller
Re: [PATCH] ipv6: fix display of local and remote sit endpoints
Cong Wang
Re: [PATCH] s2io: add dynamic LRO disable support
Tobacco New Year Promo
Eric Dumazet
Re: [PATCH] net: implement emergency route cache rebulds when gc_elasticity is exc...
git-commits-head
:
Linux Kernel Mailing List
V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer
Linux Kernel Mailing List
of/flattree: merge early_init_dt_scan_memory() common code
Linux Kernel Mailing List
b43: N-PHY: add some registers and structs definitions
Linux Kernel Mailing List
powerpc: Move /proc/ppc64 to /proc/powerpc and add symlink
Linux Kernel Mailing List
drivers/acpi: use kasprintf
openbsd-misc
:
Ted Bullock
Re: Proliant DL380 G3 cannot get on network
Eric Furman
Re: Defending OpenBSD Performance
Damien Miller
Re: Patching a SSH 'Weakness'
Tony Abernethy
Re: The Atheros story in much fewer words
Nick Holland
Re: 1 out of 3 hunks failed--saving rejects to kerberosV/src/lib/krb5/crypto.c.rej
Colocation donated by:
Syndicate