From: Lorenzo Bianconi <lorenzo@kernel.org>
To: linux-nfs@vger.kernel.org
Cc: neilb@suse.de, lorenzo.bianconi@redhat.com,
chuck.lever@oracle.com, netdev@vger.kernel.org, kuba@kernel.org,
jlayton@kernel.org
Subject: [PATCH v9 2/7] NFSD: allow callers to pass in scope string to nfsd_svc
Date: Tue, 23 Apr 2024 15:25:39 +0200 [thread overview]
Message-ID: <1b3af9bafba481a561e7e4c0f42409dfed16115e.1713878413.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1713878413.git.lorenzo@kernel.org>
From: Jeff Layton <jlayton@kernel.org>
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 <jlayton@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
fs/nfsd/nfsctl.c | 2 +-
fs/nfsd/nfsd.h | 2 +-
fs/nfsd/nfssvc.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 2fe78b802f98..34148d73b6c1 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -405,7 +405,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
return -EINVAL;
trace_nfsd_ctl_threads(net, newthreads);
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);
if (rv < 0)
return rv;
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 16c5a05f340e..2f6c6f3815b4 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -103,7 +103,7 @@ bool nfssvc_encode_voidres(struct svc_rqst *rqstp,
/*
* 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_nrthreads(struct net *);
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index ca193f7ff0e1..e25b9b829749 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -769,7 +769,7 @@ int nfsd_set_nrthreads(int n, int *nthreads, struct net *net)
* this is the first time nrservs is nonzero.
*/
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;
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)
if (nrservs == 0 && nn->nfsd_serv == NULL)
goto out;
- strscpy(nn->nfsd_name, utsname()->nodename,
+ strscpy(nn->nfsd_name, scope ? scope : utsname()->nodename,
sizeof(nn->nfsd_name));
error = nfsd_create_serv(net);
--
2.44.0
next prev parent reply other threads:[~2024-04-23 13:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 13:25 [PATCH v9 0/7] convert write_threads, write_version and write_ports to netlink commands Lorenzo Bianconi
2024-04-23 13:25 ` [PATCH v9 1/7] NFSD: move nfsd_mutex handling into nfsd_svc callers Lorenzo Bianconi
2024-04-23 13:25 ` Lorenzo Bianconi [this message]
2024-04-23 13:25 ` [PATCH v9 3/7] NFSD: convert write_threads to netlink command Lorenzo Bianconi
2024-04-23 13:25 ` [PATCH v9 4/7] NFSD: add write_version " Lorenzo Bianconi
2024-04-23 13:25 ` [PATCH v9 5/7] SUNRPC: introduce svc_xprt_create_from_sa utility routine Lorenzo Bianconi
2024-04-23 13:25 ` [PATCH v9 6/7] SUNRPC: add a new svc_find_listener helper Lorenzo Bianconi
2024-04-23 13:25 ` [PATCH v9 7/7] NFSD: add listener-{set,get} netlink command Lorenzo Bianconi
2024-04-25 14:07 ` [PATCH v9 0/7] convert write_threads, write_version and write_ports to netlink commands Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b3af9bafba481a561e7e4c0f42409dfed16115e.1713878413.git.lorenzo@kernel.org \
--to=lorenzo@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).