Re: [PATCH v6 16/20] nfsd: add a fi_connectable flag to struct nfs4_file
"Chuck Lever" <[email protected]>
| Newsgroups | gmane.linux.documentation,gmane.linux.kernel,gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jun 11, 2026, at 1:50 PM, Jeff Layton wrote: > When encoding a filehandle for a CB_NOTIFY, there is no svc_export > available, but the server needs to know whether to encode a connectable > filehandle. Add a flag to the nfs4_file that tells whether the > svc_export under which a directory delegation was acquired has subtree > checking enabled, in which case it needs connectable filehandles. > > Signed-off-by: Jeff Layton <[email protected]> > --- > fs/nfsd/nfs4state.c | 1 + > fs/nfsd/state.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index 513cbc1a583f..aa99783ce901 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -5231,6 +5231,7 @@ static void nfsd4_file_init(const struct svc_fh > *fh, struct nfs4_file *fp) > memset(fp->fi_access, 0, sizeof(fp->fi_access)); > fp->fi_aliased = false; > fp->fi_inode = d_inode(fh->fh_dentry); > + fp->fi_connectable = !(fh->fh_export->ex_flags & > NFSEXP_NOSUBTREECHECK); > #ifdef CONFIG_NFSD_PNFS > INIT_LIST_HEAD(&fp->fi_lo_states); > atomic_set(&fp->fi_lo_recalls, 0); > diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h > index f8457e0f2b57..d912e3d04dd7 100644 > --- a/fs/nfsd/state.h > +++ b/fs/nfsd/state.h > @@ -761,6 +761,7 @@ struct nfs4_file { > int fi_delegees; > struct knfsd_fh fi_fhandle; > bool fi_had_conflict; > + bool fi_connectable; > #ifdef CONFIG_NFSD_PNFS > struct list_head fi_lo_states; > atomic_t fi_lo_recalls; > When two clients use exports of the same directory root that differ only in subtree_check/no_subtree_check, the root filehandle is the same and nfsd4_file_hash_insert() can reuse the same nfs4_file. This makes fi_connectable depend on whichever export first initialized the shared object, so a later directory delegation acquired under the other export can encode CB_NOTIFY child filehandles with the wrong connectability. Therefore, the delegation's sc_export is the per-export state to derive connectability from, and the export is already available via dp->dl_stid.sc_export. -- Chuck Lever