From mboxrd@z Thu Jan 1 00:00:00 1970 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 09E57285CB4 for ; Fri, 20 Mar 2026 11:39:41 +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=1774006782; cv=none; b=nzpwNOB2qu8wW5PAeIg1eyWx4iHdCawLDCowpQTjIPjNtFjAJARsz0JySLBc9rolbr8GB05s7d/NQ6wtPxlRueBv4l8lg/fqfueMk5X4C7JxruIr0LMrcHS4XFeuUmcpsoyEC6WnKoN7izIbNjM9g9jYRGXzkQIgN6xQINmzg5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774006782; c=relaxed/simple; bh=hLD9dA/uhlliqWrXG6r/uQ5BWHEXHyzP5wLmgUcoRAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PfZEHIQ21wnzSZQw0YYpePOnhQN2IzKl0J0TLUafhiQBZqhkl35O+TNG2ndzz2IIAjQBeSxk/lAMsd9PAQ4785FgORLC01kufFYKds1bBaX2t6PpEA5lyZrImFq5Bqw2IL2HNMAAidEiMLyQkOXwnZtfpPqPwdPzWvU/WkFqkj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cui9JZ9P; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cui9JZ9P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02393C4CEF7; Fri, 20 Mar 2026 11:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774006781; bh=hLD9dA/uhlliqWrXG6r/uQ5BWHEXHyzP5wLmgUcoRAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cui9JZ9PjMoSU1FoxY96pUne/fAVV4UqH9aiqJEDpNK3rZLraqokD026gOa8G0Lcy AU7Ahf9vidzwP+YLLuMSNzPB5EyYSHeOp81uMhbrVwyT5zNTT82G+FaxHe1NSMHVuw GhG01AgclF7hy97jNFhe8fqVPryLVgU8Q8TkZVXoiBCAzBCrMm3qgb6WobWqIn6Ybo glDrvzgJPnBdl6l0+zA9AeEUOJA78bTi/AuspawzUX1Ed3E+vPg2Jd8EDb6508f1lN 7+F4mFCuJHACSwBqJ3kLNjeEuj39+LKS/06/AmY2DnxvQ5ZclHs1M9KlC1DtIEK6CS wtyJjVbzNz0cA== From: Sasha Levin To: stable@vger.kernel.org Cc: Tom Rix , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.10.y 1/2] nfsd: define exports_proc_ops with CONFIG_PROC_FS Date: Fri, 20 Mar 2026 07:39:38 -0400 Message-ID: <20260320113939.3971291-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026032042-stalling-batboy-6b82@gregkh> References: <2026032042-stalling-batboy-6b82@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Tom Rix [ Upstream commit 340086da9a87820b40601141a0e9e87c954ac006 ] gcc with W=1 and ! CONFIG_PROC_FS fs/nfsd/nfsctl.c:161:30: error: ‘exports_proc_ops’ defined but not used [-Werror=unused-const-variable=] 161 | static const struct proc_ops exports_proc_ops = { | ^~~~~~~~~~~~~~~~ The only use of exports_proc_ops is when CONFIG_PROC_FS is defined, so its definition should be likewise conditional. Signed-off-by: Tom Rix Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Stable-dep-of: e7fcf179b82d ("NFSD: Hold net reference for the lifetime of /proc/fs/nfs/exports fd") Signed-off-by: Sasha Levin --- fs/nfsd/nfsctl.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 07e5b1b23c91f..ad7a3909ae6df 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -155,18 +155,6 @@ static int exports_net_open(struct net *net, struct file *file) return 0; } -static int exports_proc_open(struct inode *inode, struct file *file) -{ - return exports_net_open(current->nsproxy->net_ns, file); -} - -static const struct proc_ops exports_proc_ops = { - .proc_open = exports_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = seq_release, -}; - static int exports_nfsd_open(struct inode *inode, struct file *file) { return exports_net_open(inode->i_sb->s_fs_info, file); @@ -1423,6 +1411,19 @@ static struct file_system_type nfsd_fs_type = { MODULE_ALIAS_FS("nfsd"); #ifdef CONFIG_PROC_FS + +static int exports_proc_open(struct inode *inode, struct file *file) +{ + return exports_net_open(current->nsproxy->net_ns, file); +} + +static const struct proc_ops exports_proc_ops = { + .proc_open = exports_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release, +}; + static int create_proc_exports_entry(void) { struct proc_dir_entry *entry; -- 2.51.0