On Fri, 2026-12-04 at 15:20 +0100, Salvatore Bonaccorso wrote: > 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: > > > 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. > > > > 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/sadpr02mb574770b2c27ca5277d9878958ce8...@sadpr02mb574770.namprd02.prod.outlook.com/T/#mf090eb57d7770d471224ec0cb6a564ae2010d75f > > Jeff Layton determined: > > > 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") > > > > 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
This all looks fine to me. Thanks for doing this, Salvatore. Reviewed-by: Jeff Layton <[email protected]>

