[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <176903566115.16766.12892778448343562390@noble.neil.brown.name>
Date: Thu, 22 Jan 2026 09:47:41 +1100
From: NeilBrown <neilb@...mail.net>
To: "Jeff Layton" <jlayton@...nel.org>
Cc: "Christoph Hellwig" <hch@...radead.org>,
"Christian Brauner" <brauner@...nel.org>,
"Alexander Viro" <viro@...iv.linux.org.uk>,
"Chuck Lever" <chuck.lever@...cle.com>,
"Olga Kornievskaia" <okorniev@...hat.com>,
"Dai Ngo" <Dai.Ngo@...cle.com>, "Tom Talpey" <tom@...pey.com>,
"Amir Goldstein" <amir73il@...il.com>, "Hugh Dickins" <hughd@...gle.com>,
"Baolin Wang" <baolin.wang@...ux.alibaba.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Theodore Ts'o" <tytso@....edu>,
"Andreas Dilger" <adilger.kernel@...ger.ca>, "Jan Kara" <jack@...e.com>,
"Gao Xiang" <xiang@...nel.org>, "Chao Yu" <chao@...nel.org>,
"Yue Hu" <zbestahu@...il.com>, "Jeffle Xu" <jefflexu@...ux.alibaba.com>,
"Sandeep Dhavale" <dhavale@...gle.com>,
"Hongbo Li" <lihongbo22@...wei.com>, "Chunhai Guo" <guochunhai@...o.com>,
"Carlos Maiolino" <cem@...nel.org>, "Ilya Dryomov" <idryomov@...il.com>,
"Alex Markuze" <amarkuze@...hat.com>,
"Viacheslav Dubeyko" <slava@...eyko.com>, "Chris Mason" <clm@...com>,
"David Sterba" <dsterba@...e.com>,
"Luis de Bethencourt" <luisbg@...nel.org>,
"Salah Triki" <salah.triki@...il.com>,
"Phillip Lougher" <phillip@...ashfs.org.uk>,
"Steve French" <sfrench@...ba.org>, "Paulo Alcantara" <pc@...guebit.org>,
"Ronnie Sahlberg" <ronniesahlberg@...il.com>,
"Shyam Prasad N" <sprasad@...rosoft.com>,
"Bharath SM" <bharathsm@...rosoft.com>,
"Miklos Szeredi" <miklos@...redi.hu>,
"Mike Marshall" <hubcap@...ibond.com>,
"Martin Brandenburg" <martin@...ibond.com>,
"Mark Fasheh" <mark@...heh.com>, "Joel Becker" <jlbec@...lplan.org>,
"Joseph Qi" <joseph.qi@...ux.alibaba.com>,
"Konstantin Komarov" <almaz.alexandrovich@...agon-software.com>,
"Ryusuke Konishi" <konishi.ryusuke@...il.com>,
"Trond Myklebust" <trondmy@...nel.org>,
"Anna Schumaker" <anna@...nel.org>, "Dave Kleikamp" <shaggy@...nel.org>,
"David Woodhouse" <dwmw2@...radead.org>,
"Richard Weinberger" <richard@....at>, "Jan Kara" <jack@...e.cz>,
"Andreas Gruenbacher" <agruenba@...hat.com>,
"OGAWA Hirofumi" <hirofumi@...l.parknet.co.jp>,
"Jaegeuk Kim" <jaegeuk@...nel.org>, "Jonathan Corbet" <corbet@....net>,
"David Laight" <david.laight.linux@...il.com>,
"Dave Chinner" <david@...morbit.com>, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-ext4@...r.kernel.org,
linux-erofs@...ts.ozlabs.org, linux-xfs@...r.kernel.org,
ceph-devel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
linux-unionfs@...r.kernel.org, devel@...ts.orangefs.org,
ocfs2-devel@...ts.linux.dev, ntfs3@...ts.linux.dev,
linux-nilfs@...r.kernel.org, jfs-discussion@...ts.sourceforge.net,
linux-mtd@...ts.infradead.org, gfs2@...ts.linux.dev,
linux-f2fs-devel@...ts.sourceforge.net, linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 01/31] Documentation: document EXPORT_OP_NOLOCKS
On Wed, 21 Jan 2026, Jeff Layton wrote:
> On Wed, 2026-01-21 at 20:58 +1100, NeilBrown wrote:
> > On Wed, 21 Jan 2026, Jeff Layton wrote:
> > > On Tue, 2026-01-20 at 09:12 -0500, Jeff Layton wrote:
> > > > On Tue, 2026-01-20 at 08:20 -0500, Jeff Layton wrote:
> > > > > On Mon, 2026-01-19 at 23:44 -0800, Christoph Hellwig wrote:
> > > > > > On Mon, Jan 19, 2026 at 11:26:18AM -0500, Jeff Layton wrote:
> > > > > > > + EXPORT_OP_NOLOCKS - Disable file locking on this filesystem. Some
> > > > > > > + filesystems cannot properly support file locking as implemented by
> > > > > > > + nfsd. A case in point is reexport of NFS itself, which can't be done
> > > > > > > + safely without coordinating the grace period handling. Other clustered
> > > > > > > + and networked filesystems can be problematic here as well.
> > > > > >
> > > > > > I'm not sure this is very useful. It really needs to document what
> > > > > > locking semantics nfs expects, because otherwise no reader will know
> > > > > > if they set this or not.
> > > > >
> > > > > Fair point. I'll see if I can draft something better. Suggestions
> > > > > welcome.
> > > >
> > > > How about this?
> > > >
> > > > + EXPORT_OP_NOLOCKS - Disable file locking on this filesystem. Filesystems
> > > > + that want to support locking over NFS must support POSIX file locking
> > > > + semantics and must handle lock recovery requests from clients after a
> > > > + reboot. Most local disk, RAM, or pseudo-filesystems use the generic POSIX
> > > > + locking support in the kernel and naturally provide this capability. Network
> > > > + or clustered filesystems usually need special handling to do this properly.
> > >
> > > Even better, I think?
> > >
> > > +
> > > + EXPORT_OP_NOLOCKS - Disable file locking on this filesystem. Filesystems
> > > + that want to support locking over NFS must support POSIX file locking
> > > + semantics. When the server reboots, the clients will issue requests to
> > > + recover their locks, which nfsd will issue to the filesystem as new lock
> > > + requests. Those must succeed in order for lock recovery to work. Most
> > > + local disk, RAM, or pseudo-filesystems use the generic POSIX locking
> > > + support in the kernel and naturally provide this capability. Network or
> > > + clustered filesystems usually need special handling to do this properly.
> > > + Set this flag on filesystems that can't guarantee the proper semantics
> > > + (e.g. reexported NFS).
> >
> > I think this is quite thorough, which it good ... maybe too good :-) It
> > reminds me that for true NFS compatibility the fs shouldn't allow local
> > locks (or file opens!) until the grace period has passed. I don't think
> > any local filesystems enforce that - it would have to be locks.c that
> > does I expect. I doubt there would be much appetite for doing that
> > though.
> >
>
> Yeah, I don't see us ever doing that. It'd be a tricky chicken-and-egg
> problem, given the demand-driven way that the mountd upcalls work
> today. We don't even know that anything is exported until something
> asks for it.
statd keeps state in /var/lib/nfs/sm, and nfsd keeps v4 state elsewhere
in /var/lib/nfs. This state effectively records if any NFS client might
try to recover a lock.
I think the v4 state is granular enough to identify the filesystem.
lockd could be enhanced to use the same state I suspect.
We would need to generalise that state and load it at mount time and
block new state creation accordingly.
i.e. this would have to be a vfs-level thing which nfsd makes use of.
Possibly, but there are other things better worth our time.
NeilBrown
Powered by blists - more mailing lists