Re: Locking issue between NFSv4 and SMB client

Trond Myklebust
2021-09-24T03:35:42Z

On Thu, 2021-09-23 at 17:50 -0400, Bruce Fields wrote:
> On Thu, Jul 15, 2021 at 04:45:22PM -0700, dai.ngo@oracle.com wrote:
> > Hi Bruce,
>
> Oops, sorry for neglecting this.
>
> > I'm doing some locking testing between NFSv4 and SMB client and
> > think there are some issues on the server that allows both clients
> > to lock the same file at the same time.
>
> It's not too surprising to me that getting consistent locks between
> the
> two would be hard.
>
> Did you get any review from a Samba expert?  I seem to recall it
> having
> a lot of options, and I wonder if it's configured correctly for this
> case.
>
> It sounds like Samba may be giving out oplocks without getting a
> lease
> from the kernel.
>

Not if you set the "kernel oplocks" parameter in the smb.conf file. We
just added support for this in the Linux 5.14 kernel NFSv4 client.

Now that said, "kernel oplocks" will currently only support basic level
I oplocks, and cannot support level II or leases. According to the
smb.conf manpage, this is due to some incompleteness in the current VFS
lease implementation.

I'd love to get some more info from the Samba team about what is
missing from the kernel lease implementation that prevents us from
implementing these more advanced oplock/lease features. From the
description in Microsoft's docs, I'm pretty sure that NFSv4 delegations
should be able to provide all the guarantees that are required.

Jeremy, would you be able to elaborate on this topic?

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