public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: NeilBrown <neil@brown.name>
Cc: "Jeff Layton" <jlayton@kernel.org>,
	"Thorsten Leemhuis" <regressions@leemhuis.info>,
	1128861@bugs.debian.org, Tj <tj.iam.tj@proton.me>,
	linux-nfs@vger.kernel.org,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] lockd: fix TEST handling when not all permissions are available.
Date: Fri, 27 Mar 2026 09:56:38 -0400	[thread overview]
Message-ID: <465012d6-c824-4d8d-b6f6-8a2d85e30154@app.fastmail.com> (raw)
In-Reply-To: <177456522377.1851489.16395975485525163031@noble.neil.brown.name>



On Thu, Mar 26, 2026, at 6:47 PM, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
>
> The F_GETLK fcntl can work with either read access or write access or
> both.  It can query F_RDLCK and F_WRLCK locks in either case.

> diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
> index 4b6f18d97734..75e020a8bfd0 100644
> --- a/fs/lockd/svc4proc.c
> +++ b/fs/lockd/svc4proc.c
> @@ -26,6 +26,8 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct 
> nlm_args *argp,
>  	struct nlm_host		*host = NULL;
>  	struct nlm_file		*file = NULL;
>  	struct nlm_lock		*lock = &argp->lock;
> +	bool			is_test = (rqstp->rq_proc == NLMPROC_TEST ||
> +					   rqstp->rq_proc == NLMPROC_TEST_MSG);
>  	__be32			error = 0;
> 
>  	/* nfsd callbacks must have been installed for this procedure */
> @@ -46,15 +48,20 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, 
> struct nlm_args *argp,
>  	if (filp != NULL) {
>  		int mode = lock_to_openmode(&lock->fl);
> 
> +		if (is_test)
> +			mode = O_RDWR;
> +
>  		lock->fl.c.flc_flags = FL_POSIX;
> 
> -		error = nlm_lookup_file(rqstp, &file, lock);
> +		error = nlm_lookup_file(rqstp, &file, lock, mode);
>  		if (error)
>  			goto no_locks;
>  		*filp = file;
> -
>  		/* Set up the missing parts of the file_lock structure */
> -		lock->fl.c.flc_file = file->f_file[mode];
> +		if (is_test)
> +			lock->fl.c.flc_file = nlmsvc_file_file(file);
> +		else
> +			lock->fl.c.flc_file = file->f_file[mode];
>  		lock->fl.c.flc_pid = current->tgid;
>  		lock->fl.fl_start = (loff_t)lock->lock_start;
>  		lock->fl.fl_end = lock->lock_len ?

We have a new problem now (or maybe just I do).

I think the stable folks will insist on this fix going into
upstream first. However, this version of the fix does not
apply to nfsd-testing because that branch has the NLMv4
xdrgen rewrite.

That rewrite is not likely to be backported to LTS. So this
version will have to be directed to stable once upstream has
been fixed. We cannot rely on automation to get upstream's
version of the fix backported to v6.19 and earlier.


-- 
Chuck Lever

  reply	other threads:[~2026-03-27 13:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24  2:09 Regression: Missing check in nfsd_permission() causes -ENOLCK No locks available Tj
2026-02-24 12:50 ` Tj
2026-02-27  9:54 ` Thorsten Leemhuis
2026-03-04 10:28   ` Bug#1128861: " Salvatore Bonaccorso
2026-03-04 15:05   ` Olga Kornievskaia
2026-03-12 12:30   ` Jeff Layton
2026-03-12 22:39     ` NeilBrown
2026-03-13 14:11       ` Jeff Layton
2026-03-04 15:44 ` Sasha Levin
2026-03-04 23:03 ` NeilBrown
2026-03-12  8:55   ` Thorsten Leemhuis
2026-03-12 12:10     ` Jeff Layton
2026-03-24 10:13       ` [PATCH] lockd: fix TEST handling when not all permissions are available NeilBrown
2026-03-24 11:25         ` Jeff Layton
2026-03-25  6:44           ` NeilBrown
2026-03-24 14:59         ` Chuck Lever
2026-03-25  7:08           ` NeilBrown
2026-03-25 13:28             ` Chuck Lever
2026-03-26 22:33               ` NeilBrown
2026-03-26 22:47               ` [PATCH v2] " NeilBrown
2026-03-27 13:56                 ` Chuck Lever [this message]
2026-04-01 12:54                   ` Bug#1128861: " Uwe Kleine-König
2026-04-01 13:34                     ` Chuck Lever
2026-03-25 20:29             ` Bug#1128861: [PATCH] " Ben Hutchings

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=465012d6-c824-4d8d-b6f6-8a2d85e30154@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=1128861@bugs.debian.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=regressions@leemhuis.info \
    --cc=stable@vger.kernel.org \
    --cc=tj.iam.tj@proton.me \
    /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