diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-05-02 15:48:14 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-05-22 18:08:37 +0200 |
commit | b52878275ce54b5d3a654ed24dfb169c1c501998 (patch) | |
tree | a494327692f37aad51321c8a0c5c0e18e76ea65e /fs | |
parent | f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 (diff) | |
download | linux-stable-b52878275ce54b5d3a654ed24dfb169c1c501998.tar.gz linux-stable-b52878275ce54b5d3a654ed24dfb169c1c501998.tar.bz2 linux-stable-b52878275ce54b5d3a654ed24dfb169c1c501998.zip |
exportfs: change connectable argument to bit flags
Convert the bool connectable arguemnt into a bit flags argument and
define the EXPORT_FS_CONNECTABLE flag as a requested property of the
file handle.
We are going to add a flag for requesting non-decodeable file handles.
Acked-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20230502124817.3070545-2-amir73il@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exportfs/expfs.c | 13 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index ab88d33d106c..ab7feffe2d19 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -393,14 +393,23 @@ int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, } EXPORT_SYMBOL_GPL(exportfs_encode_inode_fh); +/** + * exportfs_encode_fh - encode a file handle from dentry + * @dentry: the object to encode + * @fid: where to store the file handle fragment + * @max_len: maximum length to store there + * @flags: properties of the requested file handle + * + * Returns an enum fid_type or a negative errno. + */ int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, - int connectable) + int flags) { int error; struct dentry *p = NULL; struct inode *inode = dentry->d_inode, *parent = NULL; - if (connectable && !S_ISDIR(inode->i_mode)) { + if ((flags & EXPORT_FH_CONNECTABLE) && !S_ISDIR(inode->i_mode)) { p = dget_parent(dentry); /* * note that while p might've ceased to be our parent already, diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index ccd8485fee04..31e4505c0df3 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -414,10 +414,11 @@ static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, struct fid *fid = (struct fid *) (fhp->fh_handle.fh_fsid + fhp->fh_handle.fh_size/4 - 1); int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; - int subtreecheck = !(exp->ex_flags & NFSEXP_NOSUBTREECHECK); + int fh_flags = (exp->ex_flags & NFSEXP_NOSUBTREECHECK) ? 0 : + EXPORT_FH_CONNECTABLE; fhp->fh_handle.fh_fileid_type = - exportfs_encode_fh(dentry, fid, &maxsize, subtreecheck); + exportfs_encode_fh(dentry, fid, &maxsize, fh_flags); fhp->fh_handle.fh_size += maxsize * 4; } else { fhp->fh_handle.fh_fileid_type = FILEID_ROOT; |