From patchwork Thu Feb 15 19:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13559111 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 127ED13A892 for ; Thu, 15 Feb 2024 19:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027065; cv=none; b=PWXNgJVTagtVF15frDCcsPqZbNCnIuzs5tSfKkUI82PkKbbKqblzHv4EBfAVIUlFk1N3wfzauyqRPJBBXginRXpS6Z6YgW+bsM33+HiyJo2TjojvXav/b7JAdCD63ZQTY0ObF9Udexz63M/vOj28nq2h8tfkNLL61GxUheDw5D4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027065; c=relaxed/simple; bh=/BG2joKruibPBzczgBI4YKClFnmxq9ARTjeFZrlK4p4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pv35rOrf7ascX13XMj4GtYbmYxq4eTrl003vMxxjibqBbN9/b+Kdy9pKwK+LvEvAUhU+tNh8966GdCNLWPDKScVflX9s7OvvUGILAXjKDCBpdzo9BsWlzEcm9abTpVdhXshpMo541XhOtkj1dp0MEvNRDhwfsSXXh0Qg+ehphXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=FmIraQSP; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="FmIraQSP" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dcc7cdb3a98so1310367276.2 for ; Thu, 15 Feb 2024 11:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1708027063; x=1708631863; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xtC6yc5Kmgw9GmQ2/1irwG8BWnRopJmQdaxwEYN2g+w=; b=FmIraQSPP9bHanIQAO3IJM9C8ulg3ZeC0hrWM453nQBbiQDf6JA5BEYSmcVnVZwF4e 4uwG5L3uMBg7Y6sQsy2Wq5qOYfMA13/4GMXUtQ23cOSL4Av0SES81sl7+z/XTkdlsvuD OVnXx4PEkocJKSL7Gr8wIA0t96ZLHPMDMzT4xhzuMUra7FQhoki4IbTsAdQWSMC0iFmK r0P89lt77EcOPbYxzQH4h8q73bTcYFtEKN3gDP2QVSIzHjxdHWECYphyMqwyLarsFAVm PsH/m31vOthw+LS1why69Tq1oq7WtNXZsM0swdR41vvSxwacz6Jdq0W9FlIes0nBD+yR D+8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708027063; x=1708631863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xtC6yc5Kmgw9GmQ2/1irwG8BWnRopJmQdaxwEYN2g+w=; b=GWCwPkG4Yo2p8PF26N//gM41SWZQB2ZDX2CY8ilnReZr5T09rE5D90z6vYF+Y1qhzu b4pSb2oswONvGmN41N6mUJwmaHdrM+vgmYCJzG3oCvMYcWdS83NU2eXgvIOwkjB6VKdY BkUlIBb3fqgz3T1bWDsChlXrFBDiR9Cyh9NGCEGAfAa0VwAOyYW7k6zRSpjE3iCsMck1 xBh+6J2MxtL4WGvM+cJOZIW/ukTG67nbv2cmG/P9cs0vYIqSnljza6f704LrYcfAiyae 5bVczm5ag73g1oR6uBqBRQG6u7TC7whf2roPdedtFCcjbsBYfb2MWn8io4wmD13r/X67 YcOw== X-Forwarded-Encrypted: i=1; AJvYcCU6qeXr40nH8Y928DvnkYz1burtSWqcHlBHWuEcDDmz5/mBvccoBrLchy2mz7NHmS/Ltqbhyh0+lfVWhvG5EfQcq6ECD4CRGeJC X-Gm-Message-State: AOJu0YyFPwNdRLbZOz65kTNhu4JRNpeSr+qz9Qba431Val8JqYFzm8XD T85VEuqSyHN4N7Cn0oPDczzxvR4niEaq4xLECba19y0Q41ZRGdm8MoyWbU4hwK42h3MqB8njmq0 3 X-Google-Smtp-Source: AGHT+IFBNyJeejZh5kRYYjLYNtRvwdXIo+Z/aatlYNHYwaWYqzL3qbbi15q4EU0u6mutdL0bBdhOiA== X-Received: by 2002:a25:ce92:0:b0:dcc:323e:e1a4 with SMTP id x140-20020a25ce92000000b00dcc323ee1a4mr3054080ybe.6.1708027063079; Thu, 15 Feb 2024 11:57:43 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id x83-20020a253156000000b00dc727104273sm18887ybx.34.2024.02.15.11.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:57:42 -0800 (PST) From: Josef Bacik To: trond.myklebust@hammerspace.com, anna@kernel.org, linux-nfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v5 1/3] sunrpc: add a struct rpc_stats arg to rpc_create_args Date: Thu, 15 Feb 2024 14:57:30 -0500 Message-ID: X-Mailer: git-send-email 2.43.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 We want to be able to have our rpc stats handled in a per network namespace manner, so add an option to rpc_create_args to specify a different rpc_stats struct instead of using the one on the rpc_program. Signed-off-by: Josef Bacik --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/clnt.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 5e9d1469c6fa..5321585c778f 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -139,6 +139,7 @@ struct rpc_create_args { const char *servername; const char *nodename; const struct rpc_program *program; + struct rpc_stat *stats; u32 prognumber; /* overrides program->number */ u32 version; rpc_authflavor_t authflavor; diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index cda0935a68c9..28f3749f6dc6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -405,7 +405,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, clnt->cl_maxproc = version->nrprocs; clnt->cl_prog = args->prognumber ? : program->number; clnt->cl_vers = version->number; - clnt->cl_stats = program->stats; + clnt->cl_stats = args->stats ? : program->stats; clnt->cl_metrics = rpc_alloc_iostats(clnt); rpc_init_pipe_dir_head(&clnt->cl_pipedir_objects); err = -ENOMEM; @@ -691,6 +691,7 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *clnt) .version = clnt->cl_vers, .authflavor = clnt->cl_auth->au_flavor, .cred = clnt->cl_cred, + .stats = clnt->cl_stats, }; return __rpc_clone_client(&args, clnt); } @@ -713,6 +714,7 @@ rpc_clone_client_set_auth(struct rpc_clnt *clnt, rpc_authflavor_t flavor) .version = clnt->cl_vers, .authflavor = flavor, .cred = clnt->cl_cred, + .stats = clnt->cl_stats, }; return __rpc_clone_client(&args, clnt); } @@ -1068,6 +1070,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, .version = vers, .authflavor = old->cl_auth->au_flavor, .cred = old->cl_cred, + .stats = old->cl_stats, }; struct rpc_clnt *clnt; int err; From patchwork Thu Feb 15 19:57:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13559112 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 376C913AA26 for ; Thu, 15 Feb 2024 19:57:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027067; cv=none; b=bEq1M6oVPwkOr+zczexN8714j7qsG16x84QFiCvSslEXVHDsGm1+KoErCDo3EqfSC7Senqdzotb3SGw9KlDHKaVqxLAqgVXtV31bJZuAAcxB4RihUypN+56RvZZpC23ui7hfdlO0IIfQEcxdrIJRRmccK7AXYMBZAhDS/ShZRkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027067; c=relaxed/simple; bh=u1dHi6mNixi1zGBfCROOYSu8eSvq8Cesu/3w1LhDWZk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qReOwbRR7NcF57a3BduAkyzBP5aoN6AYo/6QEi+t4UXbPVf6jfR/ayFskIURpwhoWRjswm8uV/sUe/9pSK4zDM1NqecxawBZEy0u66uEXjU9Vq3y36ovA5fgfaxWJ+fmmMMmszD6rsD2L/Hhydam4JBJoeE6UgsQm36RsGwtMBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=glyN6dzT; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="glyN6dzT" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dcbc6a6808fso1283964276.2 for ; Thu, 15 Feb 2024 11:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1708027064; x=1708631864; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9Yo0e/Lck+pvwePZ6CWknvlExNBTLSvDrEZMiXn1aeM=; b=glyN6dzT94/qBaWVgpCJzi4yKMXZaOZAb5T4Du2yywGOxJ3V/KSGxzyMQPPm5KT/Te L9BRBhoRbEJMtEg3vumhL3yaW7OXpE9sWuBRT90AVBbSJTM+vpxXjyFZZwtp7W1Npzn9 BOjqVAzA3HjFg00chOLkv8kj0ogPiOEYyOSB8V5f5Uy36z+8UkzJZEHDd7uR794COE/h aUSHtGYCu7/HHAD+NN2DfZzvVoX7MygpGBBuwdPsrfYg7QQ16QRdToCk/89cKiz9bwll 2z5V4joN/99a8TeUxKEQoPsxbBt/VnB8I30BxMfTg93NpK6hawhoQlZ7L1fDE9/+RqSk Z0lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708027064; x=1708631864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Yo0e/Lck+pvwePZ6CWknvlExNBTLSvDrEZMiXn1aeM=; b=GeFF/kdFeJqRLWdBqlXU+H3BkUFkRfpwDlb5TiwD1jrbdkCZYBWUcEs4Gcktyws0WO /Penyd7tIlUpIjbHz+jqK+6E5XoDZK9hpqLr4RzAkrPBWr3tAb1bHkUSGeiBQwwP4fHX mipLVjkT98k6cKs9+24jXXrHQy/fZR60bS67OhA1JJcM3tB22xAIffkbN/CYibD+WF2w NtKfK3ekeFvOUH6QvyNTH+GiunUNqzrZLW1P7q7FbP5iPe6ZU7s9mnGflxF/Zu9lSZcc yJIKEodh5Q/0LJ9V+3vGsvwleq9kpQOH9CB9MxMQA6S71w0N2JbTovBhyufZcuuG6n9B cqlQ== X-Forwarded-Encrypted: i=1; AJvYcCUYyVBqqU0/BMjZ536uRHvGdSlrTEEzpqK2Sd7nOQQkaTmnY1Er6WYYRjddBBjdfUfD7nKoBSJI2qu3TYkYrTz7Oq0kxDWixza8 X-Gm-Message-State: AOJu0YwwSO8r7+JLuskHsTy7ZKIBiC1bU2psLn6b6pzjJleAmXO1uHVN BkYqaLoFzRKkzb5BkzVAApeEKri16WBsQIGOAyXwJc8kcDJy/37Z62BYe8CUAAg= X-Google-Smtp-Source: AGHT+IGPIxn78YhbzvKca1sMjn6QO+usa+wNQs+ZF0mV5Ud5yGJ9CG6YbPUBjgVNcPPkWGvCrcJ5xQ== X-Received: by 2002:a81:ac1c:0:b0:607:f09d:b2af with SMTP id k28-20020a81ac1c000000b00607f09db2afmr746818ywh.1.1708027064134; Thu, 15 Feb 2024 11:57:44 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id gz7-20020a05690c470700b00607b3038a7dsm21954ywb.9.2024.02.15.11.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:57:43 -0800 (PST) From: Josef Bacik To: trond.myklebust@hammerspace.com, anna@kernel.org, linux-nfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v5 2/3] nfs: expose /proc/net/sunrpc/nfs in net namespaces Date: Thu, 15 Feb 2024 14:57:31 -0500 Message-ID: X-Mailer: git-send-email 2.43.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 We're using nfs mounts inside of containers in production and noticed that the nfs stats are not exposed in /proc. This is a problem for us as we use these stats for monitoring, and have to do this awkward bind mount from the main host into the container in order to get to these states. Add the rpc_proc_register call to the pernet operations entry and exit points so these stats can be exposed inside of network namespaces. Signed-off-by: Josef Bacik --- fs/nfs/inode.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index ebb8d60e1152..e11e9c34aa56 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -2427,11 +2427,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id); static int nfs_net_init(struct net *net) { nfs_clients_init(net); + rpc_proc_register(net, &nfs_rpcstat); return nfs_fs_proc_net_init(net); } static void nfs_net_exit(struct net *net) { + rpc_proc_unregister(net, "nfs"); nfs_fs_proc_net_exit(net); nfs_clients_exit(net); } @@ -2486,15 +2488,12 @@ static int __init init_nfs_fs(void) if (err) goto out1; - rpc_proc_register(&init_net, &nfs_rpcstat); - err = register_nfs_fs(); if (err) goto out0; return 0; out0: - rpc_proc_unregister(&init_net, "nfs"); nfs_destroy_directcache(); out1: nfs_destroy_writepagecache(); @@ -2524,7 +2523,6 @@ static void __exit exit_nfs_fs(void) nfs_destroy_inodecache(); nfs_destroy_nfspagecache(); unregister_pernet_subsys(&nfs_net_ops); - rpc_proc_unregister(&init_net, "nfs"); unregister_nfs_fs(); nfs_fs_proc_exit(); nfsiod_stop(); From patchwork Thu Feb 15 19:57:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13559113 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE8A13AA2A for ; Thu, 15 Feb 2024 19:57:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027067; cv=none; b=sW2YCyi0K4rP04sKD/uphBFtce/Chi9jyTVS1ziXcsHGtUqLIiANXJh9pK82nwGCVELddBHfzqFQRDfbYITSPvFsp8HSq2Oc3NfZS9NeOk2y/f5Y1WTQV9+zAq8HqJSZUcKPJ7lJmn8NXcdYFxnwNP+5W9nMxCNVmfB3PpiDs8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027067; c=relaxed/simple; bh=dT/x4S9dPhP1hnPlf39Kuz4qA5UhMAnNDKno0Sk8fNc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VWxQeKs5yKY6vWxh9H+65ZxpcXXuJHU9beTktJSSEP3gk3p+p45g+BxR0lh4HEwFG8JJTvIJ9xfr+KC4G8/srdXS24xZUhOPSZyULuJ8XCSu601GyLTwLgu4tMs/oXbWNEuVsEOQPBoktz7Ye8k+80zizS1PzbAlBPHsVJlsSj8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=O8nX5guS; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="O8nX5guS" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-db4364ecd6aso1263173276.2 for ; Thu, 15 Feb 2024 11:57:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1708027065; x=1708631865; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rtLuNkJg1GjLuVwgzWgWd67FZ5UILcvpMOYAbQXWrSg=; b=O8nX5guSmYHchJRfDiEVTDXmWFTwK/TWOipgPGZ/usgbXY9r1y1bpBWCvFTiWiWzFb +m9TUPcG13FyzoTfyiiKfv0i30En7pV7tHmeXkYFVY5+n8EsjDMm4TXepD7FsGSZf6wo WCA9bH/c28uHeyUcKXiE5teNUlxtquMPbmZtHB9vI6bXW/3jSbN2XxSHt6kzSyeDCThK mCkVEfRbr31HKqut26r5t920otWhjYeMiXHvDWjhq4Od2aC6c5R9h3t6x9Jc4DHJIC3S xbWSj3B9pT5flLAbdYMXnamd/e+Ro72P/p/cju5duVgvHntwRoiSM7B1GaZkDxASQ4m5 EpTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708027065; x=1708631865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rtLuNkJg1GjLuVwgzWgWd67FZ5UILcvpMOYAbQXWrSg=; b=Bb1Tfx82l8CI9DCFenfg827X/bsd69Jox5YK8VImLyNcV10VD7/kb3KEYjqJpg3Bnj WmPveK7chrVAOgWMfTPBm0aD0p9CuNHcUDS/iJEUb3wy4ESxyVT+ErbjcjaxxIZhrf84 JOmiTb/83XdUhUUPJqiBXFNGBYEYJvQBPKWnapDBuz59Q9R7QKlMNnNeVMVcZRjR7V3A UX7IR5+i5QLLvihv3ZEEu0gxaMNi0d73PQ1b7C7/m5tDM7/FPI3o9LL/d8gMrtU2JWiJ XWQxm0Riz0lqKmaNZq52YSrlda5NoJG8VU+XFwzYcRHuQW2OStZLiYPpBSEc3j4Zl5yj M73g== X-Forwarded-Encrypted: i=1; AJvYcCXCmn1DbMe+GagohwMsZ+OLLK/0hsXOlxc8QbnrcVWGWH4OVJav7nmak1fs+8DA+wwxPP5d902K5vmtqUC616EoF7vIdQjLcmuI X-Gm-Message-State: AOJu0YzfE2fO9tRa6KdYpqC0861Un5/0q6JAwjmHOTS/4CkYtTQt0o1Z YhdclXklgmGdzdl0e9a281XwN09Kq6C41Tevo/h3sPj4ZDIUxlHKjuwvkqSiD3wSJDYRLe/1gf7 Q X-Google-Smtp-Source: AGHT+IFJT2cfAUdh2DvQxFhOsw2AGvDCXURiriGyYuuLUTXwp0WiKTQORW4Zf3lRM3ICMO2X/HjN+A== X-Received: by 2002:a25:cec9:0:b0:dcc:4747:c54a with SMTP id x192-20020a25cec9000000b00dcc4747c54amr2459702ybe.49.1708027065026; Thu, 15 Feb 2024 11:57:45 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id i126-20020a256d84000000b00dcd25ce965esm15265ybc.41.2024.02.15.11.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:57:44 -0800 (PST) From: Josef Bacik To: trond.myklebust@hammerspace.com, anna@kernel.org, linux-nfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v5 3/3] nfs: make the rpc_stat per net namespace Date: Thu, 15 Feb 2024 14:57:32 -0500 Message-ID: <4cb938c107a6400baa723098d15dd8a3355d24e8.1708026931.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.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 Now that we're exposing the rpc stats on a per-network namespace basis, move this struct into struct nfs_net and use that to make sure only the per-network namespace stats are exposed. Signed-off-by: Josef Bacik --- fs/nfs/client.c | 5 ++++- fs/nfs/inode.c | 4 +++- fs/nfs/internal.h | 2 -- fs/nfs/netns.h | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 44eca51b2808..4d9249c99989 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -73,7 +73,6 @@ const struct rpc_program nfs_program = { .number = NFS_PROGRAM, .nrvers = ARRAY_SIZE(nfs_version), .version = nfs_version, - .stats = &nfs_rpcstat, .pipe_dir_name = NFS_PIPE_DIRNAME, }; @@ -502,6 +501,7 @@ int nfs_create_rpc_client(struct nfs_client *clp, const struct nfs_client_initdata *cl_init, rpc_authflavor_t flavor) { + struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); struct rpc_clnt *clnt = NULL; struct rpc_create_args args = { .net = clp->cl_net, @@ -513,6 +513,7 @@ int nfs_create_rpc_client(struct nfs_client *clp, .servername = clp->cl_hostname, .nodename = cl_init->nodename, .program = &nfs_program, + .stats = &nn->rpcstats, .version = clp->rpc_ops->version, .authflavor = flavor, .cred = cl_init->cred, @@ -1175,6 +1176,8 @@ void nfs_clients_init(struct net *net) #endif spin_lock_init(&nn->nfs_client_lock); nn->boot_time = ktime_get_real(); + memset(&nn->rpcstats, 0, sizeof(nn->rpcstats)); + nn->rpcstats.program = &nfs_program; nfs_netns_sysfs_setup(nn, net); } diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e11e9c34aa56..91b4d811958a 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -2426,8 +2426,10 @@ EXPORT_SYMBOL_GPL(nfs_net_id); static int nfs_net_init(struct net *net) { + struct nfs_net *nn = net_generic(net, nfs_net_id); + nfs_clients_init(net); - rpc_proc_register(net, &nfs_rpcstat); + rpc_proc_register(net, &nn->rpcstats); return nfs_fs_proc_net_init(net); } diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index e3722ce6722e..06253695fe53 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -449,8 +449,6 @@ int nfs_try_get_tree(struct fs_context *); int nfs_get_tree_common(struct fs_context *); void nfs_kill_super(struct super_block *); -extern struct rpc_stat nfs_rpcstat; - extern int __init register_nfs_fs(void); extern void __exit unregister_nfs_fs(void); extern bool nfs_sb_active(struct super_block *sb); diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h index c8374f74dce1..a68b21603ea9 100644 --- a/fs/nfs/netns.h +++ b/fs/nfs/netns.h @@ -9,6 +9,7 @@ #include #include #include +#include struct bl_dev_msg { int32_t status; @@ -34,6 +35,7 @@ struct nfs_net { struct nfs_netns_client *nfs_client; spinlock_t nfs_client_lock; ktime_t boot_time; + struct rpc_stat rpcstats; #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_nfsfs; #endif