On Wed, 2026-04-08 at 14:24 -0400, Chuck Lever wrote: > On Tue, Apr 7, 2026, at 9:21 AM, Jeff Layton wrote: > > Add a new helper function that will update the mask on the nfsd_file's > > fsnotify_mark to be a union of all current directory delegations on an > > inode. Call that when directory delegations are added or removed. > > > > Signed-off-by: Jeff Layton <[email protected]> > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > index c8fb84c38637..9a4cff08c67d 100644 > > --- a/fs/nfsd/nfs4state.c > > +++ b/fs/nfsd/nfs4state.c > > > @@ -1266,6 +1297,7 @@ static void nfs4_unlock_deleg_lease(struct > > nfs4_delegation *dp) > > WARN_ON_ONCE(!fp->fi_delegees); > > > > nfsd4_finalize_deleg_timestamps(dp, nf->nf_file); > > + nfsd_fsnotify_recalc_mask(nf); > > kernel_setlease(nf->nf_file, F_UNLCK, NULL, (void **)&dp); > > put_deleg_file(fp); > > } > > The grant path in nfsd_get_dir_deleg() uses a different ordering > (setlease first, recalc_mask after). > > Here, since the delegation being removed is still in flc_lease, > inode_lease_ignore_mask() includes its ignore flags. The mask is > computed as if the delegation is still present. > > The result is that stale FS_CREATE/FS_DELETE/FS_RENAME bits remain > in the fsnotify mark. It might be harmless in practice since the > handler finds no leases and returns early, but it creates > unnecessary work. > > Should nfs4_unlock_deleg_lease call nfsd_fsnotify_recalc_mask() > after kernel_setlease(F_UNLCK)? >
Good catch. Will fix. -- Jeff Layton <[email protected]>
