Re: Better interop for NFS/SMB file share mode/reservation

Trond Myklebust
2019-04-28T15:06:21Z

On Sun, 2019-04-28 at 09:45 -0400, Amir Goldstein wrote:
> On Sun, Apr 28, 2019 at 8:09 AM Jeff Layton <jlayton@kernel.org>
> wrote:
> > On Sat, 2019-04-27 at 16:16 -0400, Amir Goldstein wrote:
> > > [adding back samba/nfs and fsdevel]
> > >
> >
> > cc'ing Pavel too -- he did a bunch of work in this area a few years
> > ago.
> >
> > > On Fri, Apr 26, 2019 at 6:22 PM Jeff Layton <jlayton@kernel.org>
> > > wrote:
> > > > On Fri, 2019-04-26 at 10:50 -0400, J. Bruce Fields wrote:
> > > > > On Fri, Apr 26, 2019 at 04:11:00PM +0200, Amir Goldstein
> > > > > wrote:
> > > > > > On Fri, Apr 26, 2019, 4:00 PM J. Bruce Fields <
> > > > > > bfields@fieldses.org> wrote:
> > > > > >
> > > > That said, we could also look at a vfs-level mount option that
> > > > would
> > > > make the kernel enforce these for any opener. That could also
> > > > be useful,
> > > > and shouldn't be too hard to implement. Maybe even make it a
> > > > vfsmount-
> > > > level option (like -o ro is).
> > > >
> > >
> > > Yeh, I am humbly going to leave this struggle to someone else.
> > > Not important enough IMO and completely independent effort to the
> > > advisory atomic open&lock API.
> >
> > Having the kernel allow setting deny modes on any open call is a
> > non-
> > starter, for the reasons Bruce outlined earlier. This _must_ be
> > restricted in some fashion or we'll be opening up a ginormous DoS
> > mechanism.
> >
> > My proposal was to make this only be enforced by applications that
> > explicitly opt-in by setting O_SH*/O_EX* flags. It wouldn't be too
> > difficult to also allow them to be enforced on a per-fs basis via
> > mount
> > option or something. Maybe we could expand the meaning of '-o mand'
> > ?
> >
> > How would you propose that we restrict this?
> >
>
> Our communication channel is broken.
> I did not intend to propose any implicit locking.
> If samba and nfsd can opt-in with O_SHARE flags, I do not
> understand why a mount option is helpful for the cause of
> samba/nfsd interop.
>
> If someone else is interested in samba/local interop than
> yes, a mount option like suggested by Pavel could be a good option,
> but it is an orthogonal effort IMO.

If an NFS client 'opts in' to set share deny, then that still makes it
a non-optional lock for the other NFS clients, because all ordinary
open() calls will be gated by the server whether or not their
application specifies the O_SHARE flag. There is no flag in the NFS
protocol that could tell the server to ignore deny modes.

IOW: it would suffice for 1 client to use O_SHARE|O_DENY* to opt all
the other clients in.

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com