linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sachin Prabhu <sprabhu@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] nfs: Do not allow multiple mounts on same mountpoint when using -o noac
Date: Mon, 01 Aug 2011 14:29:19 +0100	[thread overview]
Message-ID: <1312205360.3800.6.camel@sprabhu.fab.redhat.com> (raw)
In-Reply-To: <20110801111936.GA16934@infradead.org>

On Mon, 2011-08-01 at 07:19 -0400, Christoph Hellwig wrote:
> On Mon, Aug 01, 2011 at 12:10:12PM +0100, Sachin Prabhu wrote:
> > Do not allow multiple mounts on same mountpoint when using -o noac
> 
> The patch content really doesn't seem to match the subject line and
> most of the content.
> 
> > 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.
> 
> > The patch checks for noac and assigns the sync flag before sget() is
> > called to obtain an already existing superblock structure.
> 
> That's a fine fix, but the the whole patch subject and description
> focusses on a side effect rather than the underlying real problem.
> 
> The underlying issue is that youwant to share superblocks when
> having multiple mounts with -o noac, which requires assigning the
> sync flag ealier. 
> 
> The check in do_add_mount simply prevents mounts with the same
> superblock and root dentry at the same mountpoint, so it will fail for
> any two nfs mounts that might be from the same server but do not share
> the superblock due to different options.  I'm actually not sure we want
> to prevent that in general, and I can't see how it could be done easily.
> 

Yes. That is essentially what the problem is. 

The problem was reported by a user who noticed that passing the 'noac'
mount option allowed them to repeatedly mount the same share on the same
mount point. I just used the same perspective when reporting the issue
upstream.

Sachin Prabhu


      reply	other threads:[~2011-08-01 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 13:50 [PATCH] nfs: Do not allow multiple mounts on same mountpoint when using -o noac Sachin Prabhu
2011-07-30 18:33 ` Trond Myklebust
2011-08-01 11:13   ` Sachin Prabhu
2011-08-01 11:10 ` Sachin Prabhu
2011-08-01 11:19   ` Christoph Hellwig
2011-08-01 13:29     ` Sachin Prabhu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312205360.3800.6.camel@sprabhu.fab.redhat.com \
    --to=sprabhu@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).