From: "J. Bruce Fields" <bfields@fieldses.org>
To: Benjamin Coddington <bcodding@redhat.com>
Cc: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com,
jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] lockd: Show pid of lockd for remote locks
Date: Fri, 2 Nov 2018 14:45:16 -0400 [thread overview]
Message-ID: <20181102184516.GA21442@fieldses.org> (raw)
In-Reply-To: <62c22ff69bf762085a35d5706bd5e9e421bfbb33.1541093385.git.bcodding@redhat.com>
On Thu, Nov 01, 2018 at 01:39:49PM -0400, Benjamin Coddington wrote:
> Commit 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific l_pid
> for remote locks") specified that the l_pid returned for F_GETLK on a local
> file that has a remote lock should be the pid of the lock manager process.
> That commit, while updating other filesystems, failed to update lockd, such
> that locks created by lockd had their fl_pid set to that of the remote
> process holding the lock. Fix that here to be the pid of lockd.
>
> Also, fix the client case so that the returned lock pid is negative, which
> indicates a remote lock on a remote file.
ACK.
Uh, I guess I'll take this if nobody else speaks up.
--b.
>
> Fixes: 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific...")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
> fs/lockd/clntproc.c | 2 +-
> fs/lockd/xdr.c | 4 ++--
> fs/lockd/xdr4.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
> index d20b92f271c2..0a67dd4250e9 100644
> --- a/fs/lockd/clntproc.c
> +++ b/fs/lockd/clntproc.c
> @@ -442,7 +442,7 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
> fl->fl_start = req->a_res.lock.fl.fl_start;
> fl->fl_end = req->a_res.lock.fl.fl_end;
> fl->fl_type = req->a_res.lock.fl.fl_type;
> - fl->fl_pid = 0;
> + fl->fl_pid = -req->a_res.lock.fl.fl_pid;
> break;
> default:
> status = nlm_stat_to_errno(req->a_res.status);
> diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
> index 7147e4aebecc..9846f7e95282 100644
> --- a/fs/lockd/xdr.c
> +++ b/fs/lockd/xdr.c
> @@ -127,7 +127,7 @@ nlm_decode_lock(__be32 *p, struct nlm_lock *lock)
>
> locks_init_lock(fl);
> fl->fl_owner = current->files;
> - fl->fl_pid = (pid_t)lock->svid;
> + fl->fl_pid = current->tgid;
> fl->fl_flags = FL_POSIX;
> fl->fl_type = F_RDLCK; /* as good as anything else */
> start = ntohl(*p++);
> @@ -269,7 +269,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
> memset(lock, 0, sizeof(*lock));
> locks_init_lock(&lock->fl);
> lock->svid = ~(u32) 0;
> - lock->fl.fl_pid = (pid_t)lock->svid;
> + lock->fl.fl_pid = current->tgid;
>
> if (!(p = nlm_decode_cookie(p, &argp->cookie))
> || !(p = xdr_decode_string_inplace(p, &lock->caller,
> diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
> index 7ed9edf9aed4..70154f376695 100644
> --- a/fs/lockd/xdr4.c
> +++ b/fs/lockd/xdr4.c
> @@ -119,7 +119,7 @@ nlm4_decode_lock(__be32 *p, struct nlm_lock *lock)
>
> locks_init_lock(fl);
> fl->fl_owner = current->files;
> - fl->fl_pid = (pid_t)lock->svid;
> + fl->fl_pid = current->tgid;
> fl->fl_flags = FL_POSIX;
> fl->fl_type = F_RDLCK; /* as good as anything else */
> p = xdr_decode_hyper(p, &start);
> @@ -266,7 +266,7 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
> memset(lock, 0, sizeof(*lock));
> locks_init_lock(&lock->fl);
> lock->svid = ~(u32) 0;
> - lock->fl.fl_pid = (pid_t)lock->svid;
> + lock->fl.fl_pid = current->tgid;
>
> if (!(p = nlm4_decode_cookie(p, &argp->cookie))
> || !(p = xdr_decode_string_inplace(p, &lock->caller,
> --
> 2.14.3
next prev parent reply other threads:[~2018-11-02 18:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 17:39 [PATCH] lockd: Show pid of lockd for remote locks Benjamin Coddington
2018-11-02 18:45 ` J. Bruce Fields [this message]
2018-12-14 17:50 ` J. Bruce Fields
2019-05-17 21:45 Xuewei Zhang
2019-05-18 12:09 ` Benjamin Coddington
2019-05-19 2:15 ` Xuewei Zhang
2019-05-20 13:12 ` Benjamin Coddington
2019-05-20 14:22 ` Benjamin Coddington
2019-05-20 20:51 ` J. Bruce Fields
2019-05-21 11:18 ` Benjamin Coddington
2019-05-21 14:49 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181102184516.GA21442@fieldses.org \
--to=bfields@fieldses.org \
--cc=anna.schumaker@netapp.com \
--cc=bcodding@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).