Skip to content

Commit 9077d59

Browse files
jtlaytonchucklever
authored andcommitted
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: Jeff Layton <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 0842b4c commit 9077d59

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

fs/nfsd/nfsctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
405405
return -EINVAL;
406406
trace_nfsd_ctl_threads(net, newthreads);
407407
mutex_lock(&nfsd_mutex);
408-
rv = nfsd_svc(newthreads, net, file->f_cred);
408+
rv = nfsd_svc(newthreads, net, file->f_cred, NULL);
409409
mutex_unlock(&nfsd_mutex);
410410
if (rv < 0)
411411
return rv;

fs/nfsd/nfsd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool nfssvc_encode_voidres(struct svc_rqst *rqstp,
103103
/*
104104
* Function prototypes.
105105
*/
106-
int nfsd_svc(int nrservs, struct net *net, const struct cred *cred);
106+
int nfsd_svc(int nrservs, struct net *net, const struct cred *cred, const char *scope);
107107
int nfsd_dispatch(struct svc_rqst *rqstp);
108108

109109
int nfsd_nrthreads(struct net *);

fs/nfsd/nfssvc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ int nfsd_set_nrthreads(int n, int *nthreads, struct net *net)
769769
* this is the first time nrservs is nonzero.
770770
*/
771771
int
772-
nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
772+
nfsd_svc(int nrservs, struct net *net, const struct cred *cred, const char *scope)
773773
{
774774
int error;
775775
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)
786786
if (nrservs == 0 && nn->nfsd_serv == NULL)
787787
goto out;
788788

789-
strscpy(nn->nfsd_name, utsname()->nodename,
789+
strscpy(nn->nfsd_name, scope ? scope : utsname()->nodename,
790790
sizeof(nn->nfsd_name));
791791

792792
error = nfsd_create_serv(net);

0 commit comments

Comments
 (0)