NFS: Add secinfo procedure
Subsystems (2)
PATCH v4 3/5 NFS: Add secinfo procedure
This patch adds the nfs4 operation secinfo as a
valid nfs rpc operation.
Signed-off-by Bryan Schumaker <[email protected]>
--- fs/nfs/nfs4proc.c | 35 ++++++++++++ fs/nfs/nfs4xdr.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 1 + include/linux/nfs_xdr.h | 34 ++++++++++++ 4 files changed, 209 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +35 -0
@@ -4533,6 +4533,40 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,return status; } +static int _nfs4_proc_secinfo (struct inode *dir,const struct qstr *name,struct nfs4_secinfo_flavors *flavors) +{ +int status; +struct nfs4_secinfo_arg args = { + .dir_fh =NFS_FH (dir), + .name = name, + }; +struct nfs4_secinfo_res res = { + .flavors = flavors, + }; +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SECINFO ], + .rpc_argp = &args, + .rpc_resp = &res, + }; + +dprintk ("NFS call secinfo %s\n" , name->name); + status =nfs4_call_sync (NFS_SERVER (dir)->client,NFS_SERVER (dir), &msg, &args.seq_args, &res.seq_res,0 ); +dprintk ("NFS reply secinfo: %d\n" , status); +return status; +} + +int nfs4_proc_secinfo (struct inode *dir,const struct qstr *name,struct nfs4_secinfo_flavors *flavors) +{ +struct nfs4_exception exception = { }; +int err; +do { + err =nfs4_handle_exception (NFS_SERVER (dir), +_nfs4_proc_secinfo (dir, name, flavors), + &exception); + }while (exception.retry); +return err; +} +#ifdef CONFIG_NFS_V4_1 /* * nfs4_proc_exchange_id()
@@ -5604,6 +5638,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .clear_acl_cache = nfs4_zap_acl_attr, .close_context = nfs4_close_context, .open_context = nfs4_atomic_open, + .secinfo = nfs4_proc_secinfo, };static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
fs/nfs/nfs4xdr.c +139 -0
187 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -540,6 +540,7 @@ enum {NFSPROC4_CLNT_SETACL ,NFSPROC4_CLNT_FS_LOCATIONS ,NFSPROC4_CLNT_RELEASE_LOCKOWNER , +NFSPROC4_CLNT_SECINFO ,/* nfs41 */ NFSPROC4_CLNT_EXCHANGE_ID,
include/linux/nfs_xdr.h +34 -0
@@ -3,6 +3,7 @@#include <linux/nfsacl.h> #include <linux/nfs3.h> +#include <linux/sunrpc/gss_api.h> /* * To change the maximum rsize and wsize supported by the NFS client, adjust
@@ -936,6 +937,38 @@ struct nfs4_fs_locations_res {struct nfs4_sequence_res seq_res; }; +struct nfs4_secinfo_oid { +unsigned int len; +char data[GSS_OID_MAX_LEN ]; +}; + +struct nfs4_secinfo_gss { +struct nfs4_secinfo_oid sec_oid4; +unsigned int qop4; +unsigned int service; +}; + +struct nfs4_secinfo_flavor { +unsigned int flavor; +struct nfs4_secinfo_gss gss; +}; + +struct nfs4_secinfo_flavors { +unsigned int num_flavors; +struct nfs4_secinfo_flavor flavors[0 ]; +}; + +struct nfs4_secinfo_arg { +const struct nfs_fh *dir_fh; +const struct qstr *name; +struct nfs4_sequence_args seq_args; +}; + +struct nfs4_secinfo_res { +struct nfs4_secinfo_flavors *flavors; +struct nfs4_sequence_res seq_res; +}; +#endif /* CONFIG_NFS_V4 */ struct nfstime4 {
@@ -1106,6 +1139,7 @@ struct nfs_rpc_ops {struct nfs_open_context *ctx, int open_flags, struct iattr *iattr); +int (*secinfo)(struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *); };/*
Signature · 1 line
1.7.3.4
include/linux/nfs4.h enum { · line 546
Quoted 12 lines · Bryan Schumaker
include/linux/nfs4.h +1
-0@@ -540,6 +540,7 @@ enum {NFSPROC4_CLNT_SETACL ,NFSPROC4_CLNT_FS_LOCATIONS ,NFSPROC4_CLNT_RELEASE_LOCKOWNER , +NFSPROC4_CLNT_SECINFO ,/* nfs41 */ NFSPROC4_CLNT_EXCHANGE_ID,
Unfortunately, this hunk will break nfsstat. Let's give these patches one more cycle of testing. I'll carry them in my tree and will follow up with SteveD to see what we can do about fixing nfsstat. It is annoying that nfsstat should be required to keep a private copy of the client operation table, and it keeps biting us every time we want to add some new NFSv4.0 operation.
Cheers
Trond
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com