This patchset builds on the directory delegation work we did a few months ago, to add support for CB_NOTIFY callbacks for some events. In particular, creates, unlinks and renames. The server also sends updated directory attributes in the notifications. With this support, the client can register interest in a directory and get notifications about changes within it without losing its lease.
The series starts with patches to allow the vfs to ignore certain types of events on directories. nfsd can then request these sorts of delegations on directories, and then set up inotify watches on the directory to trigger sending CB_NOTIFY events. This has mainly been tested with pynfs, with some new testcases that I'll be posting soon. They seem to work fine with those tests, but I don't think we'll want to merge these until we have a complete client-side implementation to test against. Signed-off-by: Jeff Layton <[email protected]> --- Jeff Layton (24): filelock: add support for ignoring deleg breaks for dir change events filelock: add a tracepoint to start of break_lease() filelock: add an inode_lease_ignore_mask helper nfsd: add protocol support for CB_NOTIFY nfs_common: add new NOTIFY4_* flags proposed in RFC8881bis nfsd: allow nfsd to get a dir lease with an ignore mask vfs: add fsnotify_modify_mark_mask() nfsd: update the fsnotify mark when setting or removing a dir delegation nfsd: make nfsd4_callback_ops->prepare operation bool return nfsd: add callback encoding and decoding linkages for CB_NOTIFY nfsd: use RCU to protect fi_deleg_file nfsd: add data structures for handling CB_NOTIFY nfsd: add notification handlers for dir events nfsd: add tracepoint to dir_event handler nfsd: apply the notify mask to the delegation when requested nfsd: add helper to marshal a fattr4 from completed args nfsd: allow nfsd4_encode_fattr4_change() to work with no export nfsd: send basic file attributes in CB_NOTIFY nfsd: allow encoding a filehandle into fattr4 without a svc_fh nfsd: add a fi_connectable flag to struct nfs4_file nfsd: add the filehandle to returned attributes in CB_NOTIFY nfsd: properly track requested child attributes nfsd: track requested dir attributes nfsd: add support to CB_NOTIFY for dir attribute changes Documentation/sunrpc/xdr/nfs4_1.x | 264 ++++++++++++++- fs/attr.c | 2 +- fs/locks.c | 89 +++++- fs/namei.c | 31 +- fs/nfsd/filecache.c | 57 +++- fs/nfsd/nfs4callback.c | 60 +++- fs/nfsd/nfs4layouts.c | 5 +- fs/nfsd/nfs4proc.c | 15 + fs/nfsd/nfs4state.c | 524 ++++++++++++++++++++++++++---- fs/nfsd/nfs4xdr.c | 300 ++++++++++++++--- fs/nfsd/nfs4xdr_gen.c | 601 ++++++++++++++++++++++++++++++++++- fs/nfsd/nfs4xdr_gen.h | 20 +- fs/nfsd/state.h | 70 +++- fs/nfsd/trace.h | 21 ++ fs/nfsd/xdr4.h | 5 + fs/nfsd/xdr4cb.h | 12 + fs/notify/mark.c | 29 ++ fs/posix_acl.c | 4 +- fs/xattr.c | 4 +- include/linux/filelock.h | 54 +++- include/linux/fsnotify_backend.h | 1 + include/linux/nfs4.h | 127 -------- include/linux/sunrpc/xdrgen/nfs4_1.h | 291 ++++++++++++++++- include/trace/events/filelock.h | 38 ++- include/uapi/linux/nfs4.h | 2 - 25 files changed, 2321 insertions(+), 305 deletions(-) --- base-commit: bd5b9fd5e3d55bc412cec4bebe5a11da2151de4a change-id: 20260325-dir-deleg-339066dd1017 Best regards, -- Jeff Layton <[email protected]>
