From patchwork Mon Nov 18 21:20:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879081 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 95D74155312; Mon, 18 Nov 2024 21:20:39 +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=1731964839; cv=none; b=Q3oGCeP3q1aaRyC6arHQWFIml4IW8RkoKhBqdLfdZDphv62WkPW8Ju+18hcglpnfmjDh7kekGacih6QBwCfrQnEbeniTRxsvaUNxzSfL4AMkspsnHXuhMWLamLuIPeyj6S6zUDMG6g4ruc+7djjhlMOcg9NwJbePYzlgoUnRdyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964839; c=relaxed/simple; bh=ytUBqDm/ZNlD24zTNRBFChXh1eKV2k05IMXuHZRh6IU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F2RUTlXq/RJeZfXxPlA9OohGxELHyObtXv8kN548MZUGu5jgnZKXrPijLNjVU5r3xk1+jP52CPy0gesX+zbplnKh6uW3OE2HQCiVZ635HQhqaDGZ7wxU2eis9S/Fksygi0BtptQCw/7onLKreBJHxCfuPTthwIVKrURhZZKIBGQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f4cEwMe3; 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="f4cEwMe3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E0EBC4CED9; Mon, 18 Nov 2024 21:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964839; bh=ytUBqDm/ZNlD24zTNRBFChXh1eKV2k05IMXuHZRh6IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4cEwMe3aMjh8TquYQID+0F2uxNJ3q9f+Yhzp4oL+z0g5zBk2BUypB6iD+X4LYhPB 76SNa0y2ylJ6Z6zYQnzYVD9b1ZlJdaEM3FxvmHsARtNXJLzKdOIdEr57KefxRrXpVC g4grr2iZFrORHH7bV0yto7iC6JzPyzpKNMicUm/z7FJE5iAxzPIdrUKLHW9+zqkaGI bB+vh/hryoo4W3SnJ5MplAzO8D2o3uAb2yoYkF+bJ42jnI1o4g4MAgRBxQZ5KMdumw 53mtr/Xw31rb6y3SIDa7jEU69HHPENKF4zBll+wFf1MJcYbpSIQMpcfpVcO2cmw0bE 7q4JhYxCW2yeQ== From: cel@kernel.org To: Cc: , Jeff Layton , Dai Ngo , Chen Hanxiao Subject: [PATCH 5.15 1/5] NFSD: initialize copy->cp_clp early in nfsd4_copy for use by trace point Date: Mon, 18 Nov 2024 16:20:13 -0500 Message-ID: <20241118212035.3848-2-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Dai Ngo [ Upstream commit 15d1975b7279693d6f09398e0e2e31aca2310275 ] Prepare for adding server copy trace points. Signed-off-by: Dai Ngo Tested-by: Chen Hanxiao Stable-dep-of: 9ed666eba4e0 ("NFSD: Async COPY result needs to return a write verifier") Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 11dcf3debb1d..2b1fcf5b6bf8 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1769,6 +1769,7 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, __be32 status; struct nfsd4_copy *async_copy = NULL; + copy->cp_clp = cstate->clp; if (nfsd4_ssc_is_inter(copy)) { if (!inter_copy_offload_enable || nfsd4_copy_is_sync(copy)) { status = nfserr_notsupp; @@ -1783,7 +1784,6 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, return status; } - copy->cp_clp = cstate->clp; memcpy(©->fh, &cstate->current_fh.fh_handle, sizeof(struct knfsd_fh)); if (nfsd4_copy_is_async(copy)) { From patchwork Mon Nov 18 21:20:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879083 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 9F6441E766A; Mon, 18 Nov 2024 21:20:40 +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=1731964840; cv=none; b=jleq4Szama1Vuq4nmU1eyimaQQe1QU1hapSUfYSMO7OXFsAWFSd45Q0WYx7lGjQ6ZpHv+SP/yhRfjrlW5MtQYuMTHZe64onjMFMhVu0EtM6QZuZ4XdtD2Q4ivEIet13V6qRV/MxGxnz3lqKcXP9nqLIos9V/ph+1J2I8BJ3bZcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964840; c=relaxed/simple; bh=WlN6EyvwzLWfTLJxsOJCYPugmd+8BLbDPYS8E698i5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MHj3xKuWrhuq/nF2gx6yjbHmO4mxyJV3z16r9LDpdbsMuLf8DQsDyJ9UaIbmhbWdPOM7ZIW+Cd8b/qddDjNwGAk/LjgOE9sy5vZoqhlHwf4zOd7XLkLsrl6vJTcWGKWqGli8ONKv2BCH9VmIwCuiFBnEvICcWZ5UI0oSE1mswEs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nkvLtHJy; 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="nkvLtHJy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 119EBC4CEDB; Mon, 18 Nov 2024 21:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964840; bh=WlN6EyvwzLWfTLJxsOJCYPugmd+8BLbDPYS8E698i5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkvLtHJyNpQ2oXPr6YYy60V/HDjX3nLHlUa8t9GAQcz5awzNsEaiepnoqs+qCvBH3 KC+1ShV9KI1yQjQa4TT2FQ0jLjnwYOjO1NhnyFWYRZu1OLGWJNDrZKHQxP816sRxa0 cA9czV0gtPN28u0sg/AIDf81tKhacgrsHGU7IMVroauznxMXaUkwCCWF+owIVl+YyV KT14XJIcUP4E/USjZeGjrTOxDeMzL4IDo0rzkRNgR7t6TaYvrZklYUEB7noL9Dig3p w3H7pebOF22YEK2E+DcpemkGSPHNDO3dhgQCDseyM9sr8uhwPWVeZ1TY5F9t62rflF PX4ps0KPMKrtg== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever Subject: [PATCH 5.15 2/5] NFSD: Async COPY result needs to return a write verifier Date: Mon, 18 Nov 2024 16:20:15 -0500 Message-ID: <20241118212035.3848-4-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit 9ed666eba4e0a2bb8ffaa3739d830b64d4f2aaad ] Currently, when NFSD handles an asynchronous COPY, it returns a zero write verifier, relying on the subsequent CB_OFFLOAD callback to pass the write verifier and a stable_how4 value to the client. However, if the CB_OFFLOAD never arrives at the client (for example, if a network partition occurs just as the server sends the CB_OFFLOAD operation), the client will never receive this verifier. Thus, if the client sends a follow-up COMMIT, there is no way for the client to assess the COMMIT result. The usual recovery for a missing CB_OFFLOAD is for the client to send an OFFLOAD_STATUS operation, but that operation does not carry a write verifier in its result. Neither does it carry a stable_how4 value, so the client /must/ send a COMMIT in this case -- which will always fail because currently there's still no write verifier in the COPY result. Thus the server needs to return a normal write verifier in its COPY result even if the COPY operation is to be performed asynchronously. If the server recognizes the callback stateid in subsequent OFFLOAD_STATUS operations, then obviously it has not restarted, and the write verifier the client received in the COPY result is still valid and can be used to assess a COMMIT of the copied data, if one is needed. Reviewed-by: Jeff Layton [ cel: adjusted to apply to origin/linux-5.15.y ] Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 2b1fcf5b6bf8..08d90e0e8fae 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -718,15 +718,6 @@ nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, &access->ac_supported); } -static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net) -{ - __be32 *verf = (__be32 *)verifier->data; - - BUILD_BUG_ON(2*sizeof(*verf) != sizeof(verifier->data)); - - nfsd_copy_write_verifier(verf, net_generic(net, nfsd_net_id)); -} - static __be32 nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, union nfsd4_op_u *u) @@ -1594,7 +1585,6 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync) test_bit(NFSD4_COPY_F_COMMITTED, ©->cp_flags) ? NFS_FILE_SYNC : NFS_UNSTABLE; nfsd4_copy_set_sync(copy, sync); - gen_boot_verifier(©->cp_res.wr_verifier, copy->cp_clp->net); } static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy, @@ -1765,9 +1755,14 @@ static __be32 nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, union nfsd4_op_u *u) { - struct nfsd4_copy *copy = &u->copy; - __be32 status; + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct nfsd4_copy *async_copy = NULL; + struct nfsd4_copy *copy = &u->copy; + struct nfsd42_write_res *result; + __be32 status; + + result = ©->cp_res; + nfsd_copy_write_verifier((__be32 *)&result->wr_verifier.data, nn); copy->cp_clp = cstate->clp; if (nfsd4_ssc_is_inter(copy)) { @@ -1787,8 +1782,6 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, memcpy(©->fh, &cstate->current_fh.fh_handle, sizeof(struct knfsd_fh)); if (nfsd4_copy_is_async(copy)) { - struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); - status = nfserrno(-ENOMEM); async_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL); if (!async_copy) @@ -1800,8 +1793,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out_err; if (!nfs4_init_copy_state(nn, copy)) goto out_err; - memcpy(©->cp_res.cb_stateid, ©->cp_stateid.cs_stid, - sizeof(copy->cp_res.cb_stateid)); + memcpy(&result->cb_stateid, ©->cp_stateid.cs_stid, + sizeof(result->cb_stateid)); dup_copy_fields(copy, async_copy); async_copy->copy_task = kthread_create(nfsd4_do_async_copy, async_copy, "%s", "copy thread"); From patchwork Mon Nov 18 21:20:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879085 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 F24F21E766A; Mon, 18 Nov 2024 21:20: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=1731964842; cv=none; b=vDgrF0/405f14P0ulrFLjLg2xCerupqx5T8BAooeyQJY5PqDJXCGHtfAi2MNur2bMsaKFgUjmW0Ce2oOxDOcRIE9QP2R9nGPvgshNbK4iwqw1cfWRjsFWsBmhZme93cZjlWe27Ct5s9nEwoeWj2R5nMJUX5W3pS2smzzuDDmq0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964842; c=relaxed/simple; bh=+7sm/tQdvitSOS6l7ydW5R5PAUM8zvgonJY0FUU0fnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c2Y+cGVShObMLIx6Pkmi87ZMIkvBLGQO5todyT7yu0ZOnX7Osn8TSqoryd7yY3JKr3bXQPTec1NK6tYvx3+dk3xLU2fVhnaZAyJp1bZrzn+JEkHjJFls3nuPfiGA0sf2s27pdeB+0FcMpviLCGJP1E0m3LHrJlM8gTdbj46Ic4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=igwYNF3o; 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="igwYNF3o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B8F7C4CECF; Mon, 18 Nov 2024 21:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964841; bh=+7sm/tQdvitSOS6l7ydW5R5PAUM8zvgonJY0FUU0fnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igwYNF3o4z5UvlEu0lungLdb9op8glT7U0/uIYZBBrCZKWSjP/mmjqYD4wr0XcigP pQkwek3G70OW9MACATeVkZndk9NOV5iJoVO+xWgMZIM5FXzkz4NhgGwxbZRTT8nxm2 ZClaKhf1A5tWZ6Vzx16E7/Vdx7oAM+9a9jkWF1x75ODlTvpvsPJNrJRAKg6Kk4tAOr G3AmzeZB08DlqdkzF3Xn0eiiTazm3OuIopDf3Up9aI603XZ2Trw9rp87pdN2eGg63+ LkB86D9AbDopGMQpT3JjJT8P9CYZj5teO1rI5a4unlOEFGR8G8CjXoaBGoHuSBnqEf rVlsXhe/g/Ehw== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever Subject: [PATCH 5.15 3/5] NFSD: Limit the number of concurrent async COPY operations Date: Mon, 18 Nov 2024 16:20:17 -0500 Message-ID: <20241118212035.3848-6-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit aadc3bbea163b6caaaebfdd2b6c4667fbc726752 ] Nothing appears to limit the number of concurrent async COPY operations that clients can start. In addition, AFAICT each async COPY can copy an unlimited number of 4MB chunks, so can run for a long time. Thus IMO async COPY can become a DoS vector. Add a restriction mechanism that bounds the number of concurrent background COPY operations. Start simple and try to be fair -- this patch implements a per-namespace limit. An async COPY request that occurs while this limit is exceeded gets NFS4ERR_DELAY. The requesting client can choose to send the request again after a delay or fall back to a traditional read/write style copy. If there is need to make the mechanism more sophisticated, we can visit that in future patches. Cc: stable@vger.kernel.org Reviewed-by: Jeff Layton Link: https://nvd.nist.gov/vuln/detail/CVE-2024-49974 Signed-off-by: Chuck Lever --- fs/nfsd/netns.h | 1 + fs/nfsd/nfs4proc.c | 11 +++++++++-- fs/nfsd/nfs4state.c | 1 + fs/nfsd/xdr4.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 548422b24a7d..41c750f34473 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -152,6 +152,7 @@ struct nfsd_net { u32 s2s_cp_cl_id; struct idr s2s_cp_stateids; spinlock_t s2s_cp_lock; + atomic_t pending_async_copies; /* * Version information diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 08d90e0e8fae..54f43501fed9 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1244,6 +1244,7 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) { if (!refcount_dec_and_test(©->refcount)) return; + atomic_dec(©->cp_nn->pending_async_copies); kfree(copy->cp_src); kfree(copy); } @@ -1782,10 +1783,16 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, memcpy(©->fh, &cstate->current_fh.fh_handle, sizeof(struct knfsd_fh)); if (nfsd4_copy_is_async(copy)) { - status = nfserrno(-ENOMEM); async_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL); if (!async_copy) goto out_err; + async_copy->cp_nn = nn; + /* Arbitrary cap on number of pending async copy operations */ + if (atomic_inc_return(&nn->pending_async_copies) > + (int)rqstp->rq_pool->sp_nrthreads) { + atomic_dec(&nn->pending_async_copies); + goto out_err; + } INIT_LIST_HEAD(&async_copy->copies); refcount_set(&async_copy->refcount, 1); async_copy->cp_src = kmalloc(sizeof(*async_copy->cp_src), GFP_KERNEL); @@ -1824,7 +1831,7 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, } if (async_copy) cleanup_async_copy(async_copy); - status = nfserrno(-ENOMEM); + status = nfserr_jukebox; goto out; } diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 5ab3045c649f..a7016f738647 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -8079,6 +8079,7 @@ static int nfs4_state_create_net(struct net *net) spin_lock_init(&nn->client_lock); spin_lock_init(&nn->s2s_cp_lock); idr_init(&nn->s2s_cp_stateids); + atomic_set(&nn->pending_async_copies, 0); spin_lock_init(&nn->blocked_locks_lock); INIT_LIST_HEAD(&nn->blocked_locks_lru); diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 510978e602da..9bd1ade6ba54 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -574,6 +574,7 @@ struct nfsd4_copy { struct nfsd4_ssc_umount_item *ss_nsui; struct nfs_fh c_fh; nfs4_stateid stateid; + struct nfsd_net *cp_nn; }; static inline void nfsd4_copy_set_sync(struct nfsd4_copy *copy, bool sync) From patchwork Mon Nov 18 21:20:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879087 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 B6BDF1E766A; Mon, 18 Nov 2024 21:20:43 +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=1731964843; cv=none; b=UdStZDB195xKRmNlHjJSjP/QbUGiZR/D9kjxO0CBQqzvsyPb9Kf85rpjUHeqIcr4xdJ62lYgBAVKBGtNgDsI/36GlaszT/suE28Tki29ZMKLkZTmGvZ5PxHSyjVnf6/lCjwOmbQfFwHzmCsvKT3X/qWQxRGJVew88tp2un0t+CU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964843; c=relaxed/simple; bh=L/5WbSn0Hcf4WWyoyklgYacsCyDIHh4RMBF1geAQ6hc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oYyenVj4M2q6R6isW1LDxthC0WsTgkX9+I1v9W7Uu1yxEUL2AN4NyIygJpMr0vRzTdpiBh/8ZDIifAlmdr4ih5kFxmfHXKghdCtVUKtrBo10Hbi7gxsHYLys38jxcQEME6sCe9F6gwQNdSJYRTHXnnGeoXf3VmQMkQRnZvKEe5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yp7GiXcX; 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="Yp7GiXcX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF676C4CED7; Mon, 18 Nov 2024 21:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964843; bh=L/5WbSn0Hcf4WWyoyklgYacsCyDIHh4RMBF1geAQ6hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yp7GiXcXdtoLlp8ckiI2jqSFcgGb4UD0ixSa31DOym11WIUzSiROURvLkwKgbxqDh r7CwtTEv7l7l22yDBue+QaE1vsClzEUIQ5K2a7ymFaa4clPrpaYFgMfwnQIS5P0eQJ 06tVNlelXuG1X+zGOOJ0Ybm4q8SNjs36aIQE44rm45qXMOxsHKnE7rnzVOf/z/OiAR sns2xUSwIO7YXq2Bve09C2pwo0mrEC4hAfXq19tedSomdyzP3sNliGoo0ynNtGhp9y VkQ+fUooBi7SWs9u8GFZGMR7p3DAgZpaoP53ndLlO+1AEShsDewIIkqdGmQHYRdjD7 P3fE9lrFrKgNQ== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever , Olga Kornievskaia Subject: [PATCH 5.15 4/5] NFSD: Initialize struct nfsd4_copy earlier Date: Mon, 18 Nov 2024 16:20:19 -0500 Message-ID: <20241118212035.3848-8-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit 63fab04cbd0f96191b6e5beedc3b643b01c15889 ] Ensure the refcount and async_copies fields are initialized early. cleanup_async_copy() will reference these fields if an error occurs in nfsd4_copy(). If they are not correctly initialized, at the very least, a refcount underflow occurs. Reported-by: Olga Kornievskaia Fixes: aadc3bbea163 ("NFSD: Limit the number of concurrent async COPY operations") Reviewed-by: Jeff Layton Tested-by: Olga Kornievskaia Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 54f43501fed9..6267a41092ae 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1787,14 +1787,14 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (!async_copy) goto out_err; async_copy->cp_nn = nn; + INIT_LIST_HEAD(&async_copy->copies); + refcount_set(&async_copy->refcount, 1); /* Arbitrary cap on number of pending async copy operations */ if (atomic_inc_return(&nn->pending_async_copies) > (int)rqstp->rq_pool->sp_nrthreads) { atomic_dec(&nn->pending_async_copies); goto out_err; } - INIT_LIST_HEAD(&async_copy->copies); - refcount_set(&async_copy->refcount, 1); async_copy->cp_src = kmalloc(sizeof(*async_copy->cp_src), GFP_KERNEL); if (!async_copy->cp_src) goto out_err; From patchwork Mon Nov 18 21:20:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879089 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 346CB15D5B7; Mon, 18 Nov 2024 21:20:44 +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=1731964845; cv=none; b=DmZlgNTH/NTZWv+XwUL7lF3wtxxDGTjZWATLKaFLtbS70s8au81WvvsI4klmLTr175pN4ma7yNiclcTTIj1x8jRZQL90lruLVlMHOnmJQ/DOw6XtOx68zKQ0KBBeEWCKHCznOKGRRLm9thxz5kbkC2fXiwWo3Onpvt6CidW77zU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964845; c=relaxed/simple; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NN/dZGiTLMf0ZSQWIif0gi3hq8jC9tAZGyMxo5t5dZLC/HGm/igOQNysHXpJqHX3qD8tj6oniwx4B5rxYveBWvefsdNOXg7MaShKcpck+6sziSTZ19LZxfVrJ7npjNujXNvG0z50H065W0oC/kCqiku1Ak+fzjtAf0c7M+XT3LU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PwT75Wc0; 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="PwT75Wc0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38B30C4CEDB; Mon, 18 Nov 2024 21:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964844; bh=MmNZW2BO6/hZLJY2y2H8eprKc3nS4nEdDPVPe3ok95Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PwT75Wc0HGYh2fTs/ykDG05ui1mSvLVFNqIypM62kMRZfmqSLlaEufSN78kTSOGSX VhHx2R6oO3+mWNtdQL1d7ck0NfG7P/EIzcXwAZuV2/dGbm05iGtwbhLU8zuccx3Ct5 KfiC6D1eINYJbLy9CosHKqDncDbEpuc9ZyhRSycsYo9Ulz84C7aTX/4HId0EkKtmNE TZyEg2VXSku3tG4JNBVRJjFUlwmJzpo+6eKHGKkfOMp3OmpLDmoqGYD55FHQeIPp1r R/Anu4oEWv66Qj9StCqvGX2UVP/lPKdCpGevBReOWVIFbMcdwqDOvF+pllds9MPnPR pUbKdnqJ+YiQg== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever , Olga Kornievskaia Subject: [PATCH 5.15 5/5] NFSD: Never decrement pending_async_copies on error Date: Mon, 18 Nov 2024 16:20:21 -0500 Message-ID: <20241118212035.3848-10-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit 8286f8b622990194207df9ab852e0f87c60d35e9 ] The error flow in nfsd4_copy() calls cleanup_async_copy(), which already decrements nn->pending_async_copies. Reported-by: Olga Kornievskaia Fixes: aadc3bbea163 ("NFSD: Limit the number of concurrent async COPY operations") Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6267a41092ae..0b698e25826f 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1791,10 +1791,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, refcount_set(&async_copy->refcount, 1); /* Arbitrary cap on number of pending async copy operations */ if (atomic_inc_return(&nn->pending_async_copies) > - (int)rqstp->rq_pool->sp_nrthreads) { - atomic_dec(&nn->pending_async_copies); + (int)rqstp->rq_pool->sp_nrthreads) goto out_err; - } async_copy->cp_src = kmalloc(sizeof(*async_copy->cp_src), GFP_KERNEL); if (!async_copy->cp_src) goto out_err; From patchwork Mon Nov 18 21:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879091 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 3A80A188CDC; Mon, 18 Nov 2024 21:20:46 +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=1731964846; cv=none; b=nsrL49pPiiN+SKVdOfEH1IOYu09nZZQiwbmOKa1/8nS53XhbpOMCW8rwxKclxkAUgO6xTcHsNl9PUDfPmKW86uFALgUa2PhSuTvSx+esybCQarnwaT2sxDWpszXBPTEhmOIkjFpaSZGWiaC+/b5GR1vUmVOuLYidVT3Bl9lJzG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964846; c=relaxed/simple; bh=Gg0PuGPo4vLQ54215kFZQH2vm7QAMALQX252doUhLEU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dcEb8Jl7Oh8WB5rvUrqvQ2+HQopQ2OnEEi4OylCjc0ihwYxiv3iv9ydnqhuxawnfPFEXsMF/yIiFb8ru8Wlwmk8YCW4WRC1IdhmdzcWzrgbutxGPeHJzcvTEujSu9w5iv9TfD2gchWwypOCGotSyPgBNjsKPkvdjLmoJ075dl/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uc8gv1Rj; 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="uc8gv1Rj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FEE8C4CEDB; Mon, 18 Nov 2024 21:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964846; bh=Gg0PuGPo4vLQ54215kFZQH2vm7QAMALQX252doUhLEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uc8gv1RjtldM82aTf/+1isBHVcNQRdm/LiNCwMvmho4j4WdqkSj5/p3sZvQVTbufU GDV+WhJVUq7XkgYydYzbPzgzulzf40egailICwws/rgGYmiH3oHb7l9YiUjhwPFy5N HHlxiNXZB2DsflzhpKyxRm3w6PudjvWbGdmj9g9NX7Spuc+QqH9pndqYRNywelX5+B 5CRSYritZDWnz67Rc2TG1zwXRL6a4rRNM7fqFa/aaMuXHp8meUownInfUVx1L2eZUL 3wlaYtuLXrY43qZcme+3/XcrIsm/YXYweWh9J4+cTuQM5WMex7ep0I+S2+gN6alofe w47J2E5xh5RRw== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever Subject: [PATCH 5.15.y 06/18] NFSD: Refactor the duplicate reply cache shrinker Date: Mon, 18 Nov 2024 16:20:23 -0500 Message-ID: <20241118212035.3848-12-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit c135e1269f34dfdea4bd94c11060c83a3c0b3c12 ] Avoid holding the bucket lock while freeing cache entries. This change also caps the number of entries that are freed when the shrinker calls to reduce the shrinker's impact on the cache's effectiveness. Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- fs/nfsd/nfscache.c | 86 ++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 45 deletions(-) diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index e60313ce0fb6..7e1a53c10a7c 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -309,51 +309,16 @@ nfsd_prune_bucket_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b, } } -static long prune_bucket(struct nfsd_drc_bucket *b, struct nfsd_net *nn, - unsigned int max) -{ - struct svc_cacherep *rp, *tmp; - long freed = 0; - - list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) { - /* - * Don't free entries attached to calls that are still - * in-progress, but do keep scanning the list. - */ - if (rp->c_state == RC_INPROG) - continue; - if (atomic_read(&nn->num_drc_entries) <= nn->max_drc_entries && - time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) - break; - nfsd_reply_cache_free_locked(b, rp, nn); - if (max && freed++ > max) - break; - } - return freed; -} - -/* - * Walk the LRU list and prune off entries that are older than RC_EXPIRE. - * Also prune the oldest ones when the total exceeds the max number of entries. +/** + * nfsd_reply_cache_count - count_objects method for the DRC shrinker + * @shrink: our registered shrinker context + * @sc: garbage collection parameters + * + * Returns the total number of entries in the duplicate reply cache. To + * keep things simple and quick, this is not the number of expired entries + * in the cache (ie, the number that would be removed by a call to + * nfsd_reply_cache_scan). */ -static long -prune_cache_entries(struct nfsd_net *nn) -{ - unsigned int i; - long freed = 0; - - for (i = 0; i < nn->drc_hashsize; i++) { - struct nfsd_drc_bucket *b = &nn->drc_hashtbl[i]; - - if (list_empty(&b->lru_head)) - continue; - spin_lock(&b->cache_lock); - freed += prune_bucket(b, nn, 0); - spin_unlock(&b->cache_lock); - } - return freed; -} - static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, struct shrink_control *sc) { @@ -363,14 +328,45 @@ nfsd_reply_cache_count(struct shrinker *shrink, struct shrink_control *sc) return atomic_read(&nn->num_drc_entries); } +/** + * nfsd_reply_cache_scan - scan_objects method for the DRC shrinker + * @shrink: our registered shrinker context + * @sc: garbage collection parameters + * + * Free expired entries on each bucket's LRU list until we've released + * nr_to_scan freed objects. Nothing will be released if the cache + * has not exceeded it's max_drc_entries limit. + * + * Returns the number of entries released by this call. + */ static unsigned long nfsd_reply_cache_scan(struct shrinker *shrink, struct shrink_control *sc) { struct nfsd_net *nn = container_of(shrink, struct nfsd_net, nfsd_reply_cache_shrinker); + unsigned long freed = 0; + LIST_HEAD(dispose); + unsigned int i; - return prune_cache_entries(nn); + for (i = 0; i < nn->drc_hashsize; i++) { + struct nfsd_drc_bucket *b = &nn->drc_hashtbl[i]; + + if (list_empty(&b->lru_head)) + continue; + + spin_lock(&b->cache_lock); + nfsd_prune_bucket_locked(nn, b, 0, &dispose); + spin_unlock(&b->cache_lock); + + freed += nfsd_cacherep_dispose(&dispose); + if (freed > sc->nr_to_scan) + break; + } + + trace_nfsd_drc_gc(nn, freed); + return freed; } + /* * Walk an xdr_buf and get a CRC for at most the first RC_CSUMLEN bytes */ From patchwork Mon Nov 18 21:20:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879092 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 EDCDD188CDC; Mon, 18 Nov 2024 21:20:46 +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=1731964847; cv=none; b=p5PvUZhRcgJfKtSh1lsVNmi5n0JYYLfERr6RTXNOH3ia97SkA7tJSla09t4dX06vpdigIsQgeNoF1NhpOoPA+17fMvfQiHV1Amf/rGM7DWTKoyjpu2c6voYHUKUdceELcdCw69wZ7li+6qpLLZhcCh0/SfI7j23NKOfFGciq+cY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964847; c=relaxed/simple; bh=q1av7ZgzVCp3O0yobASQGrY6JXc5HC4GpaDkoRz9n1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XLRfSS3iL/mXcDC97G1pC2718ykmPGW1eathFhAFpvn3pGYXxCruKEBtty4Sr5DUrmRvYH1c0Hm96jFt7KWmNYnMSfkgb6CHwO5nbDY/50KkU0W26WTzfuf9ofZ1PFXd90WyRiQsJ1j8pNpythe8pdPC0dMD5tS20DMZammuEAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KYEY4bu0; 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="KYEY4bu0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 520BBC4CED7; Mon, 18 Nov 2024 21:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964846; bh=q1av7ZgzVCp3O0yobASQGrY6JXc5HC4GpaDkoRz9n1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYEY4bu0K0w3JVECcvtIBJdzwcJ3uSlFsfkr7fFeDgFX9jSU/gleGpPSLWrIhyCyr ucFx2IwcvIc0IBYVQT4KQMOu1EkxLdMUotS1o0vbaWkNvdSA6Cpz06nXrCsOirdCtD Cid9owNduE7YliQ30ik0MIH1WqG++70oKC7+bHHECA0zDzaVJJdbolpXDldgZIFKnz n0emtOYz4MoS9XJzGqIKZII1FP7788Y4Nl29i0UIQeaF2kLNL4TxTeOIEELyXCxbEj 5WTwKCpZOQ4ZPhsSdqeWsL6Idzc7ACovjQSNTEUvMIiRap4HMX1Gpjl7mLPUjRN91V 7xSH8hVr5bUlQ== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever , Amir Goldstein Subject: [PATCH 5.15.y 07/18] NFSD: Rewrite synopsis of nfsd_percpu_counters_init() Date: Mon, 18 Nov 2024 16:20:24 -0500 Message-ID: <20241118212035.3848-13-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit 5ec39944f874e1ecc09f624a70dfaa8ac3bf9d08 ] In function ‘export_stats_init’, inlined from ‘svc_export_alloc’ at fs/nfsd/export.c:866:6: fs/nfsd/export.c:337:16: warning: ‘nfsd_percpu_counters_init’ accessing 40 bytes in a region of size 0 [-Wstringop-overflow=] 337 | return nfsd_percpu_counters_init(&stats->counter, EXP_STATS_COUNTERS_NUM); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/nfsd/export.c:337:16: note: referencing argument 1 of type ‘struct percpu_counter[0]’ fs/nfsd/stats.h: In function ‘svc_export_alloc’: fs/nfsd/stats.h:40:5: note: in a call to function ‘nfsd_percpu_counters_init’ 40 | int nfsd_percpu_counters_init(struct percpu_counter counters[], int num); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Cc: Amir Goldstein Reviewed-by: Jeff Layton Stable-dep-of: 93483ac5fec6 ("nfsd: expose /proc/net/sunrpc/nfsd in net namespaces") Signed-off-by: Chuck Lever --- fs/nfsd/stats.c | 2 +- fs/nfsd/stats.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 777e24e5da33..1fe6488a1cf9 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -74,7 +74,7 @@ static int nfsd_show(struct seq_file *seq, void *v) DEFINE_PROC_SHOW_ATTRIBUTE(nfsd); -int nfsd_percpu_counters_init(struct percpu_counter counters[], int num) +int nfsd_percpu_counters_init(struct percpu_counter *counters, int num) { int i, err = 0; diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index 9b43dc3d9991..c3abe1830da5 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -36,9 +36,9 @@ extern struct nfsd_stats nfsdstats; extern struct svc_stat nfsd_svcstats; -int nfsd_percpu_counters_init(struct percpu_counter counters[], int num); -void nfsd_percpu_counters_reset(struct percpu_counter counters[], int num); -void nfsd_percpu_counters_destroy(struct percpu_counter counters[], int num); +int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); +void nfsd_percpu_counters_reset(struct percpu_counter *counters, int num); +void nfsd_percpu_counters_destroy(struct percpu_counter *counters, int num); int nfsd_stat_init(void); void nfsd_stat_shutdown(void); From patchwork Mon Nov 18 21:20:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879093 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 20EF1188CDC; Mon, 18 Nov 2024 21:20:47 +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=1731964848; cv=none; b=aD2lEftrsWxHocOjek+lVXOWqWrk2SrirW+01hJRlzCMMpCe+blBBkDoUkCmE6Ldi/p29y0+OBKfQf5RV7tD1YBLfOjdegUxmEcMni783SR9SayKQm9FBC6aMWfm9S5ZhV7zxWiyakg3KT+g1Jd5Nh0IykfBTX+x81kI7UjZ0wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964848; c=relaxed/simple; bh=f+YpxPLnF9Xk5hDE0PdJZ8o3fVAOOkTSQ3hANFDcgIM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JMcfhF0Lmq71eoCuOy4x3ntL89M8kT6F5N9ffW0Fwg/DBLmOIVz5sfqxgw+cx2uEKSuIeFckZgfnl5mElmes08+e7JWf1thVOcSAXf9RjLi2R8/xm1Pm3YjFPYVRt3Xyyv+2ffeEoj3UFM9IAHIPWx9xB31CmrjMTucZqFIcBsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Pr8ynek4; 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="Pr8ynek4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17899C4CED9; Mon, 18 Nov 2024 21:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964847; bh=f+YpxPLnF9Xk5hDE0PdJZ8o3fVAOOkTSQ3hANFDcgIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pr8ynek4VG71bFBsSh8t6iZTq+3ovcYFjPu+0O4wRNGwkN8qhwpYgwXpaZFAD85Nb ZtoibG90T40jdF7SYRQMNLTpMx7FYJwptKZ5euw8UiFriLp9AweMkAt6qIo8K9LyjM z+FTKNnMEKitOAy0yj2Ta3VbBKgiinN9jEWnq/jHlGgZZP0CMnGiDBrXN+VH8JH1eK AxWajjgsCY7UkUedYuPye3PBDyCcY/G/REN2iC78JGExr9fZvYMxpq0faafxm6/WLR DerBNMCUqbc/rxr11jun64rVBnpnqgRpoGmEaKdqjHapHmjriPStsgpaqnBwSV/Atd J+vQHPpkYEm1w== From: cel@kernel.org To: Cc: , Jeff Layton , Chuck Lever , kernel test robot , Amir Goldstein Subject: [PATCH 5.15.y 08/18] NFSD: Fix frame size warning in svc_export_parse() Date: Mon, 18 Nov 2024 16:20:25 -0500 Message-ID: <20241118212035.3848-14-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever [ Upstream commit 6939ace1f22681fface7841cdbf34d3204cc94b5 ] fs/nfsd/export.c: In function 'svc_export_parse': fs/nfsd/export.c:737:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=] 737 | } On my systems, svc_export_parse() has a stack frame of over 800 bytes, not 1040, but nonetheless, it could do with some reduction. When a struct svc_export is on the stack, it's a temporary structure used as an argument, and not visible as an actual exported FS. No need to reserve space for export_stats in such cases. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310012359.YEw5IrK6-lkp@intel.com/ Cc: Amir Goldstein Reviewed-by: Jeff Layton Stable-dep-of: 4b14885411f7 ("nfsd: make all of the nfsd stats per-network namespace") [ cel: adjusted to apply to v5.15.y ] Signed-off-by: Chuck Lever --- fs/nfsd/export.c | 32 +++++++++++++++++++++++--------- fs/nfsd/export.h | 4 ++-- fs/nfsd/stats.h | 12 ++++++------ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 668c7527b17e..16fadade86cc 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -339,12 +339,16 @@ static int export_stats_init(struct export_stats *stats) static void export_stats_reset(struct export_stats *stats) { - nfsd_percpu_counters_reset(stats->counter, EXP_STATS_COUNTERS_NUM); + if (stats) + nfsd_percpu_counters_reset(stats->counter, + EXP_STATS_COUNTERS_NUM); } static void export_stats_destroy(struct export_stats *stats) { - nfsd_percpu_counters_destroy(stats->counter, EXP_STATS_COUNTERS_NUM); + if (stats) + nfsd_percpu_counters_destroy(stats->counter, + EXP_STATS_COUNTERS_NUM); } static void svc_export_put(struct kref *ref) @@ -353,7 +357,8 @@ static void svc_export_put(struct kref *ref) path_put(&exp->ex_path); auth_domain_put(exp->ex_client); nfsd4_fslocs_free(&exp->ex_fslocs); - export_stats_destroy(&exp->ex_stats); + export_stats_destroy(exp->ex_stats); + kfree(exp->ex_stats); kfree(exp->ex_uuid); kfree_rcu(exp, ex_rcu); } @@ -744,13 +749,15 @@ static int svc_export_show(struct seq_file *m, seq_putc(m, '\t'); seq_escape(m, exp->ex_client->name, " \t\n\\"); if (export_stats) { - seq_printf(m, "\t%lld\n", exp->ex_stats.start_time); + struct percpu_counter *counter = exp->ex_stats->counter; + + seq_printf(m, "\t%lld\n", exp->ex_stats->start_time); seq_printf(m, "\tfh_stale: %lld\n", - percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_FH_STALE])); + percpu_counter_sum_positive(&counter[EXP_STATS_FH_STALE])); seq_printf(m, "\tio_read: %lld\n", - percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_IO_READ])); + percpu_counter_sum_positive(&counter[EXP_STATS_IO_READ])); seq_printf(m, "\tio_write: %lld\n", - percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_IO_WRITE])); + percpu_counter_sum_positive(&counter[EXP_STATS_IO_WRITE])); seq_putc(m, '\n'); return 0; } @@ -796,7 +803,7 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) new->ex_layout_types = 0; new->ex_uuid = NULL; new->cd = item->cd; - export_stats_reset(&new->ex_stats); + export_stats_reset(new->ex_stats); } static void export_update(struct cache_head *cnew, struct cache_head *citem) @@ -832,7 +839,14 @@ static struct cache_head *svc_export_alloc(void) if (!i) return NULL; - if (export_stats_init(&i->ex_stats)) { + i->ex_stats = kmalloc(sizeof(*(i->ex_stats)), GFP_KERNEL); + if (!i->ex_stats) { + kfree(i); + return NULL; + } + + if (export_stats_init(i->ex_stats)) { + kfree(i->ex_stats); kfree(i); return NULL; } diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h index d03f7f6a8642..f73e23bb24a1 100644 --- a/fs/nfsd/export.h +++ b/fs/nfsd/export.h @@ -64,10 +64,10 @@ struct svc_export { struct cache_head h; struct auth_domain * ex_client; int ex_flags; + int ex_fsid; struct path ex_path; kuid_t ex_anon_uid; kgid_t ex_anon_gid; - int ex_fsid; unsigned char * ex_uuid; /* 16 byte fsid */ struct nfsd4_fs_locations ex_fslocs; uint32_t ex_nflavors; @@ -76,7 +76,7 @@ struct svc_export { struct nfsd4_deviceid_map *ex_devid_map; struct cache_detail *cd; struct rcu_head ex_rcu; - struct export_stats ex_stats; + struct export_stats *ex_stats; }; /* an "export key" (expkey) maps a filehandlefragement to an diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index c3abe1830da5..ac58c4b2ab70 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -60,22 +60,22 @@ static inline void nfsd_stats_rc_nocache_inc(void) static inline void nfsd_stats_fh_stale_inc(struct svc_export *exp) { percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_FH_STALE]); - if (exp) - percpu_counter_inc(&exp->ex_stats.counter[EXP_STATS_FH_STALE]); + if (exp && exp->ex_stats) + percpu_counter_inc(&exp->ex_stats->counter[EXP_STATS_FH_STALE]); } static inline void nfsd_stats_io_read_add(struct svc_export *exp, s64 amount) { percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_READ], amount); - if (exp) - percpu_counter_add(&exp->ex_stats.counter[EXP_STATS_IO_READ], amount); + if (exp && exp->ex_stats) + percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_READ], amount); } static inline void nfsd_stats_io_write_add(struct svc_export *exp, s64 amount) { percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_WRITE], amount); - if (exp) - percpu_counter_add(&exp->ex_stats.counter[EXP_STATS_IO_WRITE], amount); + if (exp && exp->ex_stats) + percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_WRITE], amount); } static inline void nfsd_stats_payload_misses_inc(struct nfsd_net *nn) From patchwork Mon Nov 18 21:20:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879094 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 7B6B91C1AD0; Mon, 18 Nov 2024 21:20:48 +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=1731964848; cv=none; b=g3xJfJkweLSc5vxhJtcQ8OZ6OznpT7Ebt/k9ThmFraTwxJfhZObBz4P1eW213Xbqs2RPvxPPUO7TocTR0cuY4G0YmrhZas+fBTJIb8DltVoNH8jbTX8Qe5FXi+164ztF0JQFxVkgAhGCTnzJMjhAmbphcByAsfuKSF5+VoTQOKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964848; c=relaxed/simple; bh=pMxN9cSimTL+NxY1GGRZpDHAxD9P+95gaD0N9lvhVq8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ntTQj3S9V1qmLWYaAvVLX2tCwvnxM+oS3LD0J713YbqYdlwJXrussKXzRuKjLsf15goIWrCr/vTIJzRAKZ95cXE0kSUOOChoAUiVpIXOFsTvafUWozjq5Dg4J1D5+UuxlKBqc+GYXeLYL1Zp0dvwN5GMn7hCQB2OXqRKpV2/b04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A1HXeEQl; 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="A1HXeEQl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E36D1C4CECC; Mon, 18 Nov 2024 21:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964848; bh=pMxN9cSimTL+NxY1GGRZpDHAxD9P+95gaD0N9lvhVq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1HXeEQlcIJIwRgIqZ5HurACiIUJoIk7Qcy0rnwq+eMTCb45Ra4WWwI77GU/5yyCS 0dtakFhZKBJaAU9Xo7hk18wVUg7/SMFf69yHHmehSbX3mEEhkb8chslXeyjptv+Wok o793qXsGMmkjtNlwxEzxa8E4Sy6CNJipF6ACsBURdKfE2o1T92aPK+hCOvLvBur3FR hUk+xWcYLHmq6/ETQu7C3sZwnvJqlpMWNNUld1QCElMkPnD0cZpfyePlVQJSezv+T3 MgABZ7YCEBAzF6BPes9GhS67vswB7CbsoHDRdo9YGQgh6XCKyK2DP1QQhud/S2aWXu AeRWOmnBNBJIw== From: cel@kernel.org To: Cc: , Jeff Layton , Josef Bacik Subject: [PATCH 5.15.y 09/18] sunrpc: don't change ->sv_stats if it doesn't exist Date: Mon, 18 Nov 2024 16:20:26 -0500 Message-ID: <20241118212035.3848-15-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Josef Bacik [ Upstream commit ab42f4d9a26f1723dcfd6c93fcf768032b2bb5e7 ] We check for the existence of ->sv_stats elsewhere except in the core processing code. It appears that only nfsd actual exports these values anywhere, everybody else just has a write only copy of sv_stats in their svc_program. Add a check for ->sv_stats before every adjustment to allow us to eliminate the stats struct from all the users who don't report the stats. Signed-off-by: Josef Bacik Reviewed-by: Jeff Layton [ cel: adjusted to apply to v5.15.y ] Signed-off-by: Chuck Lever --- net/sunrpc/svc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 8d5897ed2816..447f515d445b 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1357,7 +1357,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) goto err_bad_proc; /* Syntactic check complete */ - serv->sv_stats->rpccnt++; + if (serv->sv_stats) + serv->sv_stats->rpccnt++; trace_svc_process(rqstp, progp->pg_name); /* Build the reply header. */ @@ -1423,7 +1424,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) goto close_xprt; err_bad_rpc: - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; svc_putnl(resv, 1); /* REJECT */ svc_putnl(resv, 0); /* RPC_MISMATCH */ svc_putnl(resv, 2); /* Only RPCv2 supported */ @@ -1436,7 +1438,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) err_bad_auth: dprintk("svc: authentication failed (%d)\n", be32_to_cpu(rqstp->rq_auth_stat)); - serv->sv_stats->rpcbadauth++; + if (serv->sv_stats) + serv->sv_stats->rpcbadauth++; /* Restore write pointer to location of accept status: */ xdr_ressize_check(rqstp, reply_statp); svc_putnl(resv, 1); /* REJECT */ @@ -1446,7 +1449,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) err_bad_prog: dprintk("svc: unknown program %d\n", prog); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; svc_putnl(resv, RPC_PROG_UNAVAIL); goto sendit; @@ -1454,7 +1458,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", rqstp->rq_vers, rqstp->rq_prog, progp->pg_name); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; svc_putnl(resv, RPC_PROG_MISMATCH); svc_putnl(resv, process.mismatch.lovers); svc_putnl(resv, process.mismatch.hivers); @@ -1463,7 +1468,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) err_bad_proc: svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; svc_putnl(resv, RPC_PROC_UNAVAIL); goto sendit; @@ -1472,7 +1478,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) rpc_stat = rpc_garbage_args; err_bad: - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; svc_putnl(resv, ntohl(rpc_stat)); goto sendit; } @@ -1513,7 +1520,8 @@ svc_process(struct svc_rqst *rqstp) if (dir != 0) { /* direction != CALL */ svc_printk(rqstp, "bad direction %d, dropping request\n", dir); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; goto out_drop; } From patchwork Mon Nov 18 21:20:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879095 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 23C801C1AD0; Mon, 18 Nov 2024 21:20:49 +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=1731964849; cv=none; b=bjiAmIX7SAOoxCC0ntPXsUH8UNcWjlSW30EUhVm91atOu35wQfL0MhSOLACIDDbPUzXS1WfKrmnbxhTws7mg3FCeGQMddn2TDUCmHGiIPzQEpeNo2rJxoGmJQmzLVCXuhW7/eg7lE2cFFRL2NGQlDXB4Cgn8WFXb044KOnn2ixs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964849; c=relaxed/simple; bh=wKem2yUs0AoriM8D++AZ/JkvgHvFjBKZX/gEJHMq4zQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CBr7RmRzJZp+3Wio6zXyJJVwveCFRwlRsBs/ICAfwqbl/IiBFfuk52G9HJvJu/HF6lbqPZpeLYJIWHejF9LUDeaB0sAOuMJ6spBT4duzUG1ttlFnBXG7tCof/bbEDKat+ZAI+yGqkVZZhAysj1ihmUUXMBmCqNNerJjOklYtWKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sw+ZlJyk; 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="Sw+ZlJyk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 924B3C4CED6; Mon, 18 Nov 2024 21:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964849; bh=wKem2yUs0AoriM8D++AZ/JkvgHvFjBKZX/gEJHMq4zQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sw+ZlJykL1wf6p2+QkyD5wfwJ2Sr8UuVx1JN3iGc/MHxyf6DDCRPBfkD7IRxjKDAK qj7JgAe47ayoetravbTVlYAIO27+AWFvkTi8ffiRHzbIgNwFsKfFIyb/AQCedhAb6K 20kuv9s/BkXDYco2gasY6/UWTfMBYRswcr8FPLw5Awsn+VWnwCZlQSQhK48euIlee4 gXGTXZwkhtDhvfKZeRvCJxRZ+GNvUn12vUS3Pay5QXJSQa2XsjceaOLOTdgLaxRvFy rRWIsIG+lLJSHHkZGToCSsLqKXd1ZQY2H4+2AOKyPouA84T9fiEH34W/jhaTsv0jym ekGX6OCX4zX/g== From: cel@kernel.org To: Cc: , Jeff Layton , Josef Bacik Subject: [PATCH 5.15.y 10/18] nfsd: stop setting ->pg_stats for unused stats Date: Mon, 18 Nov 2024 16:20:27 -0500 Message-ID: <20241118212035.3848-16-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Josef Bacik [ Upstream commit a2214ed588fb3c5b9824a21cff870482510372bb ] A lot of places are setting a blank svc_stats in ->pg_stats and never utilizing these stats. Remove all of these extra structs as we're not reporting these stats anywhere. Signed-off-by: Josef Bacik Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- fs/lockd/svc.c | 3 --- fs/nfs/callback.c | 3 --- fs/nfsd/nfssvc.c | 5 ----- 3 files changed, 11 deletions(-) diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 5579e67da17d..c33f78513f00 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -759,8 +759,6 @@ static const struct svc_version *nlmsvc_version[] = { #endif }; -static struct svc_stat nlmsvc_stats; - #define NLM_NRVERS ARRAY_SIZE(nlmsvc_version) static struct svc_program nlmsvc_program = { .pg_prog = NLM_PROGRAM, /* program number */ @@ -768,7 +766,6 @@ static struct svc_program nlmsvc_program = { .pg_vers = nlmsvc_version, /* version table */ .pg_name = "lockd", /* service name */ .pg_class = "nfsd", /* share authentication with nfsd */ - .pg_stats = &nlmsvc_stats, /* stats table */ .pg_authenticate = &lockd_authenticate, /* export authentication */ .pg_init_request = svc_generic_init_request, .pg_rpcbind_set = svc_generic_rpcbind_set, diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 8fe143cad4a2..f00fff3633f6 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -407,15 +407,12 @@ static const struct svc_version *nfs4_callback_version[] = { [4] = &nfs4_callback_version4, }; -static struct svc_stat nfs4_callback_stats; - static struct svc_program nfs4_callback_program = { .pg_prog = NFS4_CALLBACK, /* RPC service number */ .pg_nvers = ARRAY_SIZE(nfs4_callback_version), /* Number of entries */ .pg_vers = nfs4_callback_version, /* version table */ .pg_name = "NFSv4 callback", /* service name */ .pg_class = "nfs", /* authentication class */ - .pg_stats = &nfs4_callback_stats, .pg_authenticate = nfs_callback_authenticate, .pg_init_request = svc_generic_init_request, .pg_rpcbind_set = svc_generic_rpcbind_set, diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index a68e9904224a..8f1c8cbd1101 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -89,7 +89,6 @@ unsigned long nfsd_drc_max_mem; unsigned long nfsd_drc_mem_used; #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) -static struct svc_stat nfsd_acl_svcstats; static const struct svc_version *nfsd_acl_version[] = { # if defined(CONFIG_NFSD_V2_ACL) [2] = &nfsd_acl_version2, @@ -108,15 +107,11 @@ static struct svc_program nfsd_acl_program = { .pg_vers = nfsd_acl_version, .pg_name = "nfsacl", .pg_class = "nfsd", - .pg_stats = &nfsd_acl_svcstats, .pg_authenticate = &svc_set_client, .pg_init_request = nfsd_acl_init_request, .pg_rpcbind_set = nfsd_acl_rpcbind_set, }; -static struct svc_stat nfsd_acl_svcstats = { - .program = &nfsd_acl_program, -}; #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ static const struct svc_version *nfsd_version[] = { From patchwork Mon Nov 18 21:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879096 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 22B9D1C1AD0; Mon, 18 Nov 2024 21:20:49 +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=1731964850; cv=none; b=lmEBQqsXScv16IZ3ZgS3rYCblC3wFNhilPQZa4smaX9HLB4PDX5DlQhQB4NpvS26GGSkUF+2flaGfhG81QjshWib7DXzlc/PIl8zGFz/SPDUGx4cN0JyF30xdkiBO41CeSFJCg1WMlFsuNuOwbEhOvE1Bj1NPAibAHzrBblHHKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964850; c=relaxed/simple; bh=h4s8RmktF6CmgmiH3UaFCF6tImHhJIn4Y2nvhERRQBk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iOdHsroTWiVKLpad40UVDvWXFBO/+NiZQp7Zh0069MhltfhSFdFU8ZpksTXmDyGwfONaiIt2uakD/dPur5EoQd54qGaVYPH5vFeNz+laBtpuus+DSiKlXAWkaZunHROkA03udf4PjQMgGMaZHU3+PgVtRddmHFkNXVewSBtFe8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=udiFZpGb; 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="udiFZpGb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40817C4CED0; Mon, 18 Nov 2024 21:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964849; bh=h4s8RmktF6CmgmiH3UaFCF6tImHhJIn4Y2nvhERRQBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udiFZpGbx4RVH+gdaFSeRR7dvISW/cE773vd5vywMvTmchGxQhwGuqKN6709DXWJM YvNYaJowcwy2Ewf4bjfLafki5ZHNp182bdY+57+18+95HXajYpIR/dJa21YQUa73YP MmJ3eZiLNeQtc2ynM51dyZXrDlZnHuc+rL2dsYOsnGFK2lwHuZ0WAi5LWoHCJruNzb VJh7xp7cuNakaTljBJt28qo+exbLxC1fI3JrfWOX52NRKhtYbUCOh+jcZ1i2+4s8w/ YLQ8MJn2xXYsSqhohMN/UB6pb1/UBDcDYC/AzbihAZ7aRc2jBQMhBRUaIVl/uM3Bx2 WucJdokmOX1aQ== From: cel@kernel.org To: Cc: , Jeff Layton , Josef Bacik Subject: [PATCH 5.15.y 11/18] sunrpc: pass in the sv_stats struct through svc_create_pooled Date: Mon, 18 Nov 2024 16:20:28 -0500 Message-ID: <20241118212035.3848-17-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Josef Bacik [ Upstream commit f094323867668d50124886ad884b665de7319537 ] Since only one service actually reports the rpc stats there's not much of a reason to have a pointer to it in the svc_program struct. Adjust the svc_create_pooled function to take the sv_stats as an argument and pass the struct through there as desired instead of getting it from the svc_program->pg_stats. Signed-off-by: Josef Bacik Reviewed-by: Jeff Layton [ cel: adjusted to apply to v5.15.y ] Signed-off-by: Chuck Lever --- fs/nfsd/nfssvc.c | 3 ++- include/linux/sunrpc/svc.h | 4 +++- net/sunrpc/svc.c | 12 +++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 8f1c8cbd1101..f5d6924905bf 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -665,7 +665,8 @@ int nfsd_create_serv(struct net *net) if (nfsd_max_blksize == 0) nfsd_max_blksize = nfsd_get_default_max_blksize(); nfsd_reset_versions(nn); - serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, nfsd); + serv = svc_create_pooled(&nfsd_program, &nfsd_svcstats, + nfsd_max_blksize, nfsd); if (serv == NULL) return -ENOMEM; diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 6e48c1c88f1b..ff8235e6acc3 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -483,7 +483,9 @@ void svc_rqst_replace_page(struct svc_rqst *rqstp, struct page *page); void svc_rqst_free(struct svc_rqst *); void svc_exit_thread(struct svc_rqst *); -struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, +struct svc_serv * svc_create_pooled(struct svc_program *prog, + struct svc_stat *stats, + unsigned int bufsize, int (*threadfn)(void *data)); int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); int svc_pool_stats_open(struct svc_serv *serv, struct file *file); diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 447f515d445b..92d88aac2adf 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -447,8 +447,8 @@ __svc_init_bc(struct svc_serv *serv) * Create an RPC service */ static struct svc_serv * -__svc_create(struct svc_program *prog, unsigned int bufsize, int npools, - int (*threadfn)(void *data)) +__svc_create(struct svc_program *prog, struct svc_stat *stats, + unsigned int bufsize, int npools, int (*threadfn)(void *data)) { struct svc_serv *serv; unsigned int vers; @@ -460,7 +460,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, serv->sv_name = prog->pg_name; serv->sv_program = prog; kref_init(&serv->sv_refcnt); - serv->sv_stats = prog->pg_stats; + serv->sv_stats = stats; if (bufsize > RPCSVC_MAXPAYLOAD) bufsize = RPCSVC_MAXPAYLOAD; serv->sv_max_payload = bufsize? bufsize : 4096; @@ -522,26 +522,28 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, struct svc_serv *svc_create(struct svc_program *prog, unsigned int bufsize, int (*threadfn)(void *data)) { - return __svc_create(prog, bufsize, 1, threadfn); + return __svc_create(prog, NULL, bufsize, 1, threadfn); } EXPORT_SYMBOL_GPL(svc_create); /** * svc_create_pooled - Create an RPC service with pooled threads * @prog: the RPC program the new service will handle + * @stats: the stats struct if desired * @bufsize: maximum message size for @prog * @threadfn: a function to service RPC requests for @prog * * Returns an instantiated struct svc_serv object or NULL. */ struct svc_serv *svc_create_pooled(struct svc_program *prog, + struct svc_stat *stats, unsigned int bufsize, int (*threadfn)(void *data)) { struct svc_serv *serv; unsigned int npools = svc_pool_map_get(); - serv = __svc_create(prog, bufsize, npools, threadfn); + serv = __svc_create(prog, stats, bufsize, npools, threadfn); if (!serv) goto out_err; return serv; From patchwork Mon Nov 18 21:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879097 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 7701B1E9087; Mon, 18 Nov 2024 21:20:50 +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=1731964850; cv=none; b=qvAL8y1HxS5K9oz8qm+Cg+Hq3TE6AtpYG4iXZO9iOabL0fHJSsg22ozO1K7Cq+hC0CcWd7HxyqW5unZwAdKw5PUntmhri/gCqooJP8DXjsArBuScM9eDZnaFQqm6HoRkZv1Bk/EzpzrnFqek5XUKNqd57sW8Kd1AVbpX+RbunN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964850; c=relaxed/simple; bh=yCznjqq+MJmj5zm8CN6rZgNRFsI5NdBXJfIMezKrz7s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NONUNcKBFuOyvrWjd9hhu51Kuv7pisf9mDh7wQ61xLt/cxGTpI7f/9LCV1jk2OXf5YnBrN4MYzm3ssOuNcj2N4WCgypghISipTW++Ax2ogiwLUTa6Tuzyhjjb+evHT0a7xnm9vUHl+tzJLV3ApdwtrCIdWGP0IhD0vq5+8SnY1k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wen97wS/; 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="Wen97wS/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4A76C4CED6; Mon, 18 Nov 2024 21:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964850; bh=yCznjqq+MJmj5zm8CN6rZgNRFsI5NdBXJfIMezKrz7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wen97wS/QJnGfQTEwr4EwisNfZW29GHzPnYoIfW25qJfXtocYXtvAi9vVqKmG38Cf 9nErJn386HwruQ12aNQ5pcLaz2ynw61Hrowkp/l2lTWZ9xcmvucZBr0J3wyvkmb+tK d2BJ07q6DbTdKWAE4aEC8LbTVAl34ScSYG2Es31LlD6ECz4Kwc5O7tMrDAmwjT+afA 6N1X3+OBNPJUFxrHmWlnsQ5kd/NlhhosFrEHRRJMXbPlPphzqFJJni+r2O6ng0s0MF jU6RJ2QKdwOxsLPDPbfVd4XANQGgDZlN4mEOyOwDs+/KZVa644/wiijeIQBaGSZexU rNFUM+VhTSeaQ== From: cel@kernel.org To: Cc: , Jeff Layton , Josef Bacik Subject: [PATCH 5.15.y 12/18] sunrpc: remove ->pg_stats from svc_program Date: Mon, 18 Nov 2024 16:20:29 -0500 Message-ID: <20241118212035.3848-18-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Josef Bacik [ Upstream commit 3f6ef182f144dcc9a4d942f97b6a8ed969f13c95 ] Now that this isn't used anywhere, remove it. Signed-off-by: Josef Bacik Reviewed-by: Jeff Layton [ cel: adjusted to apply to v5.15.y ] Signed-off-by: Chuck Lever --- fs/nfsd/nfssvc.c | 1 - include/linux/sunrpc/svc.h | 1 - 2 files changed, 2 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index f5d6924905bf..74d21d2c5396 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -136,7 +136,6 @@ struct svc_program nfsd_program = { .pg_vers = nfsd_version, /* version table */ .pg_name = "nfsd", /* program name */ .pg_class = "nfsd", /* authentication class */ - .pg_stats = &nfsd_svcstats, /* version table */ .pg_authenticate = &svc_set_client, /* export authentication */ .pg_init_request = nfsd_init_request, .pg_rpcbind_set = nfsd_rpcbind_set, diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index ff8235e6acc3..57e0d9b7553b 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -409,7 +409,6 @@ struct svc_program { const struct svc_version **pg_vers; /* version array */ char * pg_name; /* service name */ char * pg_class; /* class name: services sharing authentication */ - struct svc_stat * pg_stats; /* rpc statistics */ int (*pg_authenticate)(struct svc_rqst *); __be32 (*pg_init_request)(struct svc_rqst *, const struct svc_program *, From patchwork Mon Nov 18 21:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13879098 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 2897C1E9087; Mon, 18 Nov 2024 21:20:51 +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=1731964851; cv=none; b=lE12EyPnTmrioA+V7V3YGnRoDmhE+u+z0RVTBII+/LaqJtOAcwsXdpvbokehsxIfjW5GLo9CSwXmxC15XXHwT7GnhGAwYgrMNDLYIOI0+rJ/gsXNzoN2RZ1wccp99xoLduSOzO7xdJ4L8InTv23LmgS+nBsZGeCVSxvd1EEaMPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731964851; c=relaxed/simple; bh=DFrpZZ2NPQLLVDIJ8ns+Q2FkuW2fBXVGphkUeZbgVzc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rBT5NUdaXGMN/I1lv3bPzMPSuWjlGTj22sWq42ab6szog3iFhZ9Zbyb3+H3JXuqpQ18EH0AI5xuzT6z7W440sS//gEwuKsrhrguW8pTFW67d2XM5YrS8+ICFwxGRzVVRwMbvBehknIocWyXxwMy4GQ/n7UgFx2fDoNCEVvp+c3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nyuAFKKs; 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="nyuAFKKs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9680CC4CEDB; Mon, 18 Nov 2024 21:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731964851; bh=DFrpZZ2NPQLLVDIJ8ns+Q2FkuW2fBXVGphkUeZbgVzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyuAFKKshtnzU37/5oWK5w2r0uEH/bX3A85pJsUG9eAbX3EDaI0nKjcensKMKdigb uVSiqEOGLkdSDkNgVPn6ArjS0QR4GCCIO9yEYv9DHuj/tE//lHKCQnL6FpuAET8Lko pk4bGLifsFPATOuKJH/nihGWZqGnFA80wowUNlFwKdC+aZ+hkaTKPzMVYZxnACIUfu nWOyv0yPBZpwgwNWivRIv4dwx95Nl19yYh2q3LOMgINIOOUD15RTCEdupL8CEJ/b9u eFOTyTT2wn/BUB99TUnn/4izFc5z2szRIyElsWOQ0WyyyuDW/Z1qjfJ4AYZ3qJdk62 H2MFHmF7CABpw== From: cel@kernel.org To: Cc: , Jeff Layton , Josef Bacik Subject: [PATCH 5.15.y 13/18] sunrpc: use the struct net as the svc proc private Date: Mon, 18 Nov 2024 16:20:30 -0500 Message-ID: <20241118212035.3848-19-cel@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241118212035.3848-1-cel@kernel.org> References: <20241118212035.3848-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Josef Bacik [ Upstream commit 418b9687dece5bd763c09b5c27a801a7e3387be9 ] nfsd is the only thing using this helper, and it doesn't use the private currently. When we switch to per-network namespace stats we will need the struct net * in order to get to the nfsd_net. Use the net as the proc private so we can utilize this when we make the switch over. Signed-off-by: Josef Bacik Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- net/sunrpc/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index c964b48eaaba..a004c3ef35c0 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -309,7 +309,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister); struct proc_dir_entry * svc_proc_register(struct net *net, struct svc_stat *statp, const struct proc_ops *proc_ops) { - return do_register(net, statp->program->pg_name, statp, proc_ops); + return do_register(net, statp->program->pg_name, net, proc_ops); } EXPORT_SYMBOL_GPL(svc_proc_register);