]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
filelock: push the S_ISREG check down to ->setlease handlers
authorJeff Layton <jlayton@kernel.org>
Tue, 11 Nov 2025 14:12:45 +0000 (09:12 -0500)
committerChristian Brauner <brauner@kernel.org>
Wed, 12 Nov 2025 08:38:35 +0000 (09:38 +0100)
commite6d28ebc17eb5e011b80c42a5196af0570c12240
tree66fc5a9e21a386d9306258813cb2ac9e4ab119fd
parent6976ed2dd0d59086d16d853ac9b21776be68aaad
filelock: push the S_ISREG check down to ->setlease handlers

When nfsd starts requesting directory delegations, setlease handlers may
see requests for leases on directories. Push the !S_ISREG check down
into the non-trivial setlease handlers, so we can selectively enable
them where they're supported.

FUSE is special: It's the only filesystem that supports atomic_open and
allows kernel-internal leases. atomic_open is issued when the VFS
doesn't know the state of the dentry being opened. If the file doesn't
exist, it may be created, in which case the dir lease should be broken.

The existing kernel-internal lease implementation has no provision for
this. Ensure that we don't allow directory leases by default going
forward by explicitly disabling them there.

Reviewed-by: NeilBrown <neil@brown.name>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20251111-dir-deleg-ro-v6-4-52f3feebb2f2@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fuse/dir.c
fs/locks.c
fs/nfs/nfs4file.c
fs/smb/client/cifsfs.c