Skip to content

Backport for "NLM/NFSD: Fix lock notifications for async-capable"

Salvatore Bonaccorso linux-nfs regressions stable 1 version Applied

Status from this message: Queued the series for 6.12, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4fs: Introduce FOP_ASYNC_LOCKinclude/linux/filelock.h include/linux/fs.h+7 -00 replies
2/4gfs2/ocfs2: set FOP_ASYNC_LOCKfs/gfs2/file.c fs/ocfs2/file.c+4 -00 replies
3/4NLM/NFSD: Fix lock notifications for async-capable filesystemsfs/lockd/svclock.c fs/nfsd/nfs4state.c+7 -190 replies
4/4nfsd: fix FL_SLEEP being set unconditionally for all LOCK typesfs/nfsd/nfs4state.c+5 -40 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJeff Layton
SeriesR-b
1/4R-b
2/4R-b
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 6.12.y 0/4] Backport for "NLM/NFSD: Fix lock notifications for async-capable"

Hi

In Debian bug https://bugs.debian.org/1153524 reported a regression after updating from 6.1.y to the 6.12.y series, explained as follows:

Quoted 43 lines

After upgrading an NFS server from the bookworm 6.1 kernel to the trixie 6.12 kernel, blocking locks taken on an NFSv4.2 export by two different clients are no longer woken up when the holder releases them. The waiting client stalls for about 30 seconds (the client-side NFS4_LOCK_MAXTIMEOUT back-off) instead of getting the lock as soon as it is released. Setup

* Server: Debian 13.7, linux-image-6.12.116+deb13-amd64 6.12.116-

      1, nfs-kernel-server 1:2.8.3-1. The export is on ext4 (md RAID),
      options sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,roo-
      t_squash,no_all_squash.

* Clients: two Debian 13 hosts running 6.12.116+deb13-amd64,
mounted with vers=4.2.
* The clients have run 6.12 since August 2026, and cross-client
locking worked while the server ran 6.1.0-54-amd64. The stalls started on 2026-11-05, when the server moved to 6.12.115-1. Nothing changed on the clients that day, so the regression is on the server side.

Reproducer

client A:  flock -x /mnt/share/testfile sleep 5
client B (1.5 s later):  time flock -x -w 60 /mnt/share/testfile true

Expected: B gets the lock after about 3.5 s. Observed on 2026-11-09 with 6.12.116-1: 31.61 s. With both processes on client A, the wait is 3.51 s. Server-side traces (6.12.115-1, 2026-11-06, kernel tracepoints during the same test)

* The blocking LOCK from client B (WRITEW_LT) reaches nfsd, but
nfsd sets the lock without FL_SLEEP: posix_lock_inode shows fl_flags=FL_POSIX only. The server therefore treats it as non-
blocking: it returns NFS4ERR_DENIED and records no blocked lock.
* When client A releases the lock (OP_LOCKU), no nfsd_cb_queue or
nfsd_cb_notify_lock event appears. CB_NOTIFY_LOCK is never sent.
* The client behaves as designed. It waits for the notification up
to the 30 s cap, then retries: two LOCK attempts in total, at t0 and at t0+31 s.
* I found a recent nfsd series that fixes the FL_SLEEP test in
nfsd4_lock (introduced by 7e64c5bc497c), but for the opposite
case: FL_SLEEP wrongly set on non-blocking locks. This report may be the mirror case, but I have not confirmed the root cause.

Quoted 6 lines

Impact
Any application that serialises on files shared across NFS clients stalls for 30 s per contended lock. In our case, PHP file sessions on a two-node web front caused gateway timeouts. We have worked around it (sessions moved to a database, load-balancer session affinity), but the bug still affects other shared directories.

It was forwarded to th NFS list:

https://lore.kernel.org/linux-nfs/SADPR02MB574770B2C27CA5277D9878958CE84D2@SADPR02MB574770.namprd02.prod.outlook.com/T/#mf090eb57d7770d471224ec0cb6a564ae2010d75f

Jeff Layton determined:

Quoted 8 lines

Ben Coddington's series fixed the check in v6.13. None of it went to 6.12.y:

8cf9a01edc21 ("fs: Introduce FOP_ASYNC_LOCK") 2253ab99f2e9 ("gfs2/ocfs2: set FOP_ASYNC_LOCK") 7e64c5bc497c ("NLM/NFSD: Fix lock notifications for async-capable
filesystems")

Quoted 4 lines

The recent patch you noticed is 246a90a5109b ("nfsd: fix FL_SLEEP being set unconditionally for all LOCK types"). It fixes a bug that 7e64c5bc497c introduced, so it needs to be backported along with the other three.

The 4 patches following are matching the above.

*Though* I defintively prefer if those will come directly from Jeff or will get an ack from him here.

In Debian we will be in need to apply those ideally with the next round of updates we are going to push.

Regards,
Salvatore