Commit 9077d598 authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever

NFSD: allow callers to pass in scope string to nfsd_svc

Currently admins set this by using unshare to create a new uts
namespace, and then resetting the hostname. With the new netlink
interface we can just pass this in directly. Prepare nfsd_svc for
this change.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 0842b4c8
...@@ -405,7 +405,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size) ...@@ -405,7 +405,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
return -EINVAL; return -EINVAL;
trace_nfsd_ctl_threads(net, newthreads); trace_nfsd_ctl_threads(net, newthreads);
mutex_lock(&nfsd_mutex); mutex_lock(&nfsd_mutex);
rv = nfsd_svc(newthreads, net, file->f_cred); rv = nfsd_svc(newthreads, net, file->f_cred, NULL);
mutex_unlock(&nfsd_mutex); mutex_unlock(&nfsd_mutex);
if (rv < 0) if (rv < 0)
return rv; return rv;
......
...@@ -103,7 +103,7 @@ bool nfssvc_encode_voidres(struct svc_rqst *rqstp, ...@@ -103,7 +103,7 @@ bool nfssvc_encode_voidres(struct svc_rqst *rqstp,
/* /*
* Function prototypes. * Function prototypes.
*/ */
int nfsd_svc(int nrservs, struct net *net, const struct cred *cred); int nfsd_svc(int nrservs, struct net *net, const struct cred *cred, const char *scope);
int nfsd_dispatch(struct svc_rqst *rqstp); int nfsd_dispatch(struct svc_rqst *rqstp);
int nfsd_nrthreads(struct net *); int nfsd_nrthreads(struct net *);
......
...@@ -769,7 +769,7 @@ int nfsd_set_nrthreads(int n, int *nthreads, struct net *net) ...@@ -769,7 +769,7 @@ int nfsd_set_nrthreads(int n, int *nthreads, struct net *net)
* this is the first time nrservs is nonzero. * this is the first time nrservs is nonzero.
*/ */
int int
nfsd_svc(int nrservs, struct net *net, const struct cred *cred) nfsd_svc(int nrservs, struct net *net, const struct cred *cred, const char *scope)
{ {
int error; int error;
struct nfsd_net *nn = net_generic(net, nfsd_net_id); struct nfsd_net *nn = net_generic(net, nfsd_net_id);
...@@ -786,7 +786,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred) ...@@ -786,7 +786,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
if (nrservs == 0 && nn->nfsd_serv == NULL) if (nrservs == 0 && nn->nfsd_serv == NULL)
goto out; goto out;
strscpy(nn->nfsd_name, utsname()->nodename, strscpy(nn->nfsd_name, scope ? scope : utsname()->nodename,
sizeof(nn->nfsd_name)); sizeof(nn->nfsd_name));
error = nfsd_create_serv(net); error = nfsd_create_serv(net);
......
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