Hi, On Tue, Sep 10, 2024 at 11:45 AM Jeff Layton <jlayton@xxxxxxxxxx> 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, > > Alex, thoughts? The question is here if we ever want that posix_lock_file() receives a posix lock that has flc_flags and the FL_SLEEP set. As mentioned, may "posix_lock_file()" can just deal with it and will not block? This patch indeed broke it as posix_lock_file() will never see a lock request with FL_SLEEP set, but I remembered that nfs is only polling locks and "probably" never set FL_SLEEP? Thanks. - Alex