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

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

 



Hi,

On Tue, Sep 10, 2024 at 12:56 PM Benjamin Coddington
<bcodding@xxxxxxxxxx> 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.

go ahead with the name change.

About the uncertainty the other changes, except this one mentioned
above here in the reply, was a revert of commit 40595cdc93ed ("block
notification on fs with its own ->lock") that had removed a similar
flag to in kind of a reverse logic.
The flag means something that the commit message says "... filesystems
with "good" ->lock methods to support blocking lock notifications.".

- Alex






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux