Re: [PATCH 1/7] lockd: introduce safe async lock op

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-09-10 at 12:56 -0400, Benjamin Coddington wrote:
> On 10 Sep 2024, at 11:45, Jeff Layton wrote:
> 
> > On Tue, 2024-09-10 at 10:18 -0400, Benjamin Coddington wrote:
> > > On 23 Aug 2023, at 17:33, Alexander Aring wrote:
> > > 
> > > > This patch reverts mostly commit 40595cdc93ed ("nfs: block notification
> > > > on fs with its own ->lock") and introduces an EXPORT_OP_SAFE_ASYNC_LOCK
> > > > export flag to signal that the "own ->lock" implementation supports
> > > > async lock requests. The only main user is DLM that is used by GFS2 and
> > > > OCFS2 filesystem. Those implement their own lock() implementation and
> > > > return FILE_LOCK_DEFERRED as return value. Since commit 40595cdc93ed
> > > > ("nfs: block notification on fs with its own ->lock") the DLM
> > > > implementation were never updated. This patch should prepare for DLM
> > > > to set the EXPORT_OP_SAFE_ASYNC_LOCK export flag and update the DLM
> > > > plock implementation regarding to it.
> > > > 
> > > > Acked-by: Jeff Layton <jlayton@xxxxxxxxxx>
> > > > Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx>
> > > > ---
> > > >  fs/lockd/svclock.c       |  5 ++---
> > > >  fs/nfsd/nfs4state.c      | 13 ++++++++++---
> > > >  include/linux/exportfs.h |  8 ++++++++
> > > >  3 files changed, 20 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
> > > > index c43ccdf28ed9..6e3b230e8317 100644
> > > > --- a/fs/lockd/svclock.c
> > > > +++ b/fs/lockd/svclock.c
> > > > @@ -470,9 +470,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
> > > >  	    struct nlm_host *host, struct nlm_lock *lock, int wait,
> > > >  	    struct nlm_cookie *cookie, int reclaim)
> > > >  {
> > > > -#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
> > > >  	struct inode		*inode = nlmsvc_file_inode(file);
> > > > -#endif
> > > >  	struct nlm_block	*block = NULL;
> > > >  	int			error;
> > > >  	int			mode;
> > > > @@ -486,7 +484,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
> > > >  				(long long)lock->fl.fl_end,
> > > >  				wait);
> > > > 
> > > > -	if (nlmsvc_file_file(file)->f_op->lock) {
> > > > +	if (!export_op_support_safe_async_lock(inode->i_sb->s_export_op,
> > > > +					       nlmsvc_file_file(file)->f_op)) {
> > > 
> > > ... but don't most filesystem use VFS' posix_lock_file(), which does the
> > > right thing?  I think this patch has broken async lock callbacks for NLM for
> > > all the other filesystems that just use posix_lock_file().
> > > 
> > > Maybe I'm missing something, but why was that necessary?
> > > 
> > 
> > Good catch. Yeah, I think that probably should have been an &&
> > condition. IOW:
> > 
> > 	if (nlmsvc_file_file(file)->f_op->lock &&
> >             !export_op_support_safe_async_lock(inode->i_sb->s_export_op,
> > 
> 
> Ah Jeff, thanks for confirming - there's been a bunch of changes in there that
> made me uncertain.  I can send a patch for this, I'd like to rename
> export_op_support_safe_async_lock to something like fs_can_defer_lock
> (suggestions) and put the test in there.

Actually, I take it back. The only callers that set
export_op_support_safe_async_lock have ->lock as non-NULL, so that
won't change anything, in practice.
-- 
Jeff Layton <jlayton@xxxxxxxxxx>





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux