Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2942396lqt; Tue, 23 Apr 2024 06:28:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyhTYKTA7TpFnWgLPb61TAwLVDEJ0OOi/2rt4dqklE3qLstnfFEmZBBEhhfpsqrZYSSLCcadYSE9l707DKmKHovuOWRSMFPUE5D7jvIA== X-Google-Smtp-Source: AGHT+IGIDCt73B4oGT7I9v/3epXFsmmFmm3MvFbEpusN/llpgCPjKizPj7rsl/zMiaarbaY4WiBj X-Received: by 2002:a17:90b:3796:b0:2ad:e055:bb34 with SMTP id mz22-20020a17090b379600b002ade055bb34mr5578094pjb.3.1713878939019; Tue, 23 Apr 2024 06:28:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713878939; cv=pass; d=google.com; s=arc-20160816; b=c8BE+Uaeo+l9hIMfOTNN20aPA05MPto6gBMtslRDvFWYvJWGTv+K1WxqOCCaI1ve68 5Nb6JAdQZ5c07pnfFmZ6rdMlDL6M8QISITv7/DQSrVV6bmLTgdbhbRTGHbJyXdOc92fR CPzdkX9z7//6nDXb6Aum0VEY26zWiA9r7szs3Zq070T4BICCDQh80glYQZDoyFXivk6/ pKvkxuwowu3NtHcrYpzXTWzzeZOsOzK1wdIw2W3Um6WAkhitXW9WBY4PNt37//tRKmeu YGPwonUmxMBB4prMzuwXj96lRjtP/0EvK5HBQ98bgr8I1Vijaut8I/VMNeHtKa+qPp5T 6JEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1ZBM87Gr6KxmLQ24l2sMc1rvywI+fvQraPC94GTBFEM=; fh=DMCDS8gUzVrNgxbf14gHb/h+T7HG77KdNqMH/8ibnkw=; b=PRVg3I9QIb2xmboHwEt1nV8gY60V/RN/Yr0rkSW7XEDOKX9Ijjy4R75OLmh4bjaxNC jGixD5XpEjxehvolz2bsXzFPS3pc7wosXXfESYMH8WX2zHjk2Va5paSu0jxCw2T7D3EF b1TkI30R05Zhccrl/m/NirvBeKSV9OSrYyde2hGMlLg1tYtkipdqU3Tgqj9Wdgr3Zh/l 4DCv41NzFz+tED49VQDyLWYOeIeqo+iIFYHNqj+eMd4zUSbN9OChPeVkjicG9axMrvTR gmjJ/2URCt+qqkJGtvyOksSWEl2uGJGNXRRHmOdyaBQkj3K/jIZgUAK5pHRpf5Xdrgcb Gbwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="lCODRll/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-2949-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2949-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j13-20020a17090a7e8d00b002a539f46c08si9677867pjl.39.2024.04.23.06.28.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2949-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="lCODRll/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-2949-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2949-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 08A82288611 for ; Tue, 23 Apr 2024 13:26:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E536613666F; Tue, 23 Apr 2024 13:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lCODRll/" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE2BB135A61; Tue, 23 Apr 2024 13:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713878765; cv=none; b=iS88k5JApzsGAODsyRYhZ+JFUa67sUhcMbBHzSHunVHdZ8pFqbD/vL0m074cbBTAYZ+OVjv9ycbi0DdTGs5FHp9rJgX0wkICcldMZFL0qKrRuLFb900HwZawtPKxQIueoVEVH8juTjJUJajyomTx7FzcGWCzUBmcytFoYVe+ckU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713878765; c=relaxed/simple; bh=4h+Tu88oHjRIeAS0PQPioRNPY+xGkKq0dyKgovl0y74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RaOiKOCJr5yUWe1yIc40AxC0E3eUQzCsHU2XC0o2AvS3zuLtDCTWvohmKZNq7CP94aCpmjj9rlSYN74C2o4p3T5N+Ys75M1rSh4K0Qbr/lFJqW1mRmt9nvlGG+wqsBLjNsDv63kSSNRNbf7uzHkvkyzNG6sSn+0mK3zUDb1EkKI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lCODRll/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D58C116B1; Tue, 23 Apr 2024 13:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713878765; bh=4h+Tu88oHjRIeAS0PQPioRNPY+xGkKq0dyKgovl0y74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCODRll/0qb6/s7Ar/Y63Y2IzICzRWV758FFqtxXFvM9gqYPdRlkt9g5a+SU9abIp bcgxndwbJomSyUrLtihRH+GInXxSw5xjQ4F+AESUwUQ25PwmBcWPIPyAyqmpod75Jc +dXNET9iqZjXskj41YUcgTWB0nAU0klZ7KyA9y09fgh4Alwv6Lhz4oDefddl2k1f6d mO0RMkpuP/yMPu9N8Qyg0DdkILll6K/JLizLip0bevUCmIUDfA1YKX9neuw+Phn2p4 xK7QwHMHLgQBtPyjBLaJ3H8oF4WaAjFrgjJB3tVYd3bOTn1udSwXMeJj6P7dpM8uA9 QU3sEX6tKMoTA== From: Lorenzo Bianconi 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 Message-ID: <1b3af9bafba481a561e7e4c0f42409dfed16115e.1713878413.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jeff Layton 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 Signed-off-by: Lorenzo Bianconi --- 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