From: NeilBrown <neilb@ownmail.net>
To: "Jeff Layton" <jlayton@kernel.org>
Cc: "Thorsten Leemhuis" <regressions@leemhuis.info>,
"Tj" <tj.iam.tj@proton.me>,
1128861@bugs.debian.org, linux-nfs@vger.kernel.org,
"Olga Kornievskaia" <okorniev@redhat.com>,
stable@vger.kernel.org, "Chuck Lever" <chuck.lever@oracle.com>
Subject: Re: Regression: Missing check in nfsd_permission() causes -ENOLCK No locks available
Date: Fri, 13 Mar 2026 09:39:36 +1100 [thread overview]
Message-ID: <177335517622.5556.4792770517095870331@noble.neil.brown.name> (raw)
In-Reply-To: <5a302dcfcb54a87366dd6a9bc5ec27df179f7f58.camel@kernel.org>
On Thu, 12 Mar 2026, Jeff Layton wrote:
> On Fri, 2026-02-27 at 10:54 +0100, Thorsten Leemhuis wrote:
> > > This was discovered on the Debian openQA infrastructure server when
> > > upgrading kernel from v6.12.48 to later v6.12.y where worker hosts (with
> > > any earlier or later kernel version) pass NFSv3 mounted ISO images to
> > > qemu-system-x86_64 and it reports:
> > >
> > > !!! : qemu-system-x86_64: -device
> > > scsi-cd,id=cd0-device,drive=cd0-overlay0,serial=cd0: Failed to get
> > > "consistent read" lock: No locks available
> > > QEMU: Is another process using the image
> > > [/var/lib/openqa/pool/2/20260223-1-debian-testing-amd64-netinst.iso]?
> > >
>
> I have to wonder if this is a QEMU bug too:
>
> Why is it opening a file read-only and then taking out an exclusive
> lock on it? What's the point of denying access to other readers?
It turns out that I mis-diagnosed the problem. i.e. I guess wrong as to
what weird thing qemu is doing.
qemu isn't using flock(). It is using fcntl() locking but at this point
isn't trying to GET a lock, it is testing if a lock already exists.
i.e. F_GETLK or F_OFD_GETLK.
F_GETLK doesn't require WRITE access, even when getting an exclusive
lock.
But NFSD does :-)
So maybe this is the fix that we want.
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 255a847ca0b6..67234686ef8c 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -632,7 +632,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
goto out;
}
- mode = lock_to_openmode(&lock->fl);
+ mode = O_RDONLY;
locks_init_lock(&conflock->fl);
/* vfs_test_lock only uses start, end, and owner, but tests flc_file */
conflock->fl.c.flc_file = lock->fl.c.flc_file;
????
NeilBrown
next prev parent reply other threads:[~2026-03-12 22:39 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 [this message]
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
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=177335517622.5556.4792770517095870331@noble.neil.brown.name \
--to=neilb@ownmail.net \
--cc=1128861@bugs.debian.org \
--cc=chuck.lever@oracle.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).