Commit 029be5d0 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: Add custom rpcbind callbacks for knfsd

Add custom rpcbind callbacks in preparation for the knfsd
per-container version feature.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 642ee6b2
...@@ -32,6 +32,18 @@ ...@@ -32,6 +32,18 @@
extern struct svc_program nfsd_program; extern struct svc_program nfsd_program;
static int nfsd(void *vrqstp); static int nfsd(void *vrqstp);
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
static int nfsd_acl_rpcbind_set(struct net *,
const struct svc_program *,
u32, int,
unsigned short,
unsigned short);
#endif
static int nfsd_rpcbind_set(struct net *,
const struct svc_program *,
u32, int,
unsigned short,
unsigned short);
/* /*
* nfsd_mutex protects nn->nfsd_serv -- both the pointer itself and the members * nfsd_mutex protects nn->nfsd_serv -- both the pointer itself and the members
...@@ -87,7 +99,7 @@ static struct svc_program nfsd_acl_program = { ...@@ -87,7 +99,7 @@ static struct svc_program nfsd_acl_program = {
.pg_stats = &nfsd_acl_svcstats, .pg_stats = &nfsd_acl_svcstats,
.pg_authenticate = &svc_set_client, .pg_authenticate = &svc_set_client,
.pg_init_request = svc_generic_init_request, .pg_init_request = svc_generic_init_request,
.pg_rpcbind_set = svc_generic_rpcbind_set, .pg_rpcbind_set = nfsd_acl_rpcbind_set,
}; };
static struct svc_stat nfsd_acl_svcstats = { static struct svc_stat nfsd_acl_svcstats = {
...@@ -121,7 +133,7 @@ struct svc_program nfsd_program = { ...@@ -121,7 +133,7 @@ struct svc_program nfsd_program = {
.pg_stats = &nfsd_svcstats, /* version table */ .pg_stats = &nfsd_svcstats, /* version table */
.pg_authenticate = &svc_set_client, /* export authentication */ .pg_authenticate = &svc_set_client, /* export authentication */
.pg_init_request = svc_generic_init_request, .pg_init_request = svc_generic_init_request,
.pg_rpcbind_set = svc_generic_rpcbind_set, .pg_rpcbind_set = nfsd_rpcbind_set,
}; };
static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = { static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
...@@ -670,6 +682,38 @@ nfsd_svc(int nrservs, struct net *net) ...@@ -670,6 +682,38 @@ nfsd_svc(int nrservs, struct net *net)
return error; return error;
} }
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
static bool
nfsd_support_acl_version(int vers)
{
if (vers >= NFSD_ACL_MINVERS && vers < NFSD_ACL_NRVERS)
return nfsd_acl_version[vers] != NULL;
return false;
}
static int
nfsd_acl_rpcbind_set(struct net *net, const struct svc_program *progp,
u32 version, int family, unsigned short proto,
unsigned short port)
{
if (!nfsd_support_acl_version(version) ||
!nfsd_vers(version, NFSD_TEST))
return 0;
return svc_generic_rpcbind_set(net, progp, version, family,
proto, port);
}
#endif
static int
nfsd_rpcbind_set(struct net *net, const struct svc_program *progp,
u32 version, int family, unsigned short proto,
unsigned short port)
{
if (!nfsd_vers(version, NFSD_TEST))
return 0;
return svc_generic_rpcbind_set(net, progp, version, family,
proto, port);
}
/* /*
* This is the NFS server kernel thread * This is the NFS server kernel thread
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment