Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Dan Aloni <dan.aloni@vastdata.com>
To: linux-nfs@vger.kernel.org
Subject: mount options not propagating to NFSACL and NSM RPC clients
Date: Sun, 5 Nov 2023 17:48:57 +0200	[thread overview]
Message-ID: <20231105154857.ryakhmgaptq3hb6b@gmail.com> (raw)

Hi,

On Linux v6.6-14500-g1c41041124bd, I added a sysfs file for debugging
`/sys/kernel/debug/sunrpc/rpc_clnt/*/info`, and noticed that when
passing the following mount options: `soft,timeo=50,retrans=16,vers=3`,
NFSACL and NSM seem to take the defaults from somewhere else (xprt).
Specifically, locking operation behave as if in a hard mount with
these mount options.

Is it intentional?

    cl_prog: 100000
    cl_softrtry: 1
    cl_timeout: to_initval=10000, to_maxval=10000, to_increment=0, to_retries=2, to_exponential=0

    cl_prog: 100003
    cl_softrtry: 1
    cl_timeout: to_initval=5000, to_maxval=85000, to_increment=5000, to_retries=16, to_exponential=0

    cl_prog: 100000
    cl_softrtry: 1
    cl_timeout: to_initval=10000, to_maxval=10000, to_increment=0, to_retries=2, to_exponential=0

    cl_prog: 100021
    cl_softrtry: 0
    cl_timeout: to_initval=10000, to_maxval=60000, to_increment=10000, to_retries=5, to_exponential=0

    cl_prog: 100003
    cl_softrtry: 1
    cl_timeout: to_initval=5000, to_maxval=85000, to_increment=5000, to_retries=16, to_exponential=0

    cl_prog: 100227
    cl_softrtry: 1
    cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0
    

Also, here's the patch I used to expose this information:

-- >8 --
Subject: [PATCH] sunrpc: add per-client 'info' node in debugfs

---
 net/sunrpc/debugfs.c | 75 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index a176d5a0b0ee..61a2cc01815d 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -142,6 +142,77 @@ static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *n
 	return 0;
 }
 
+static int
+clnt_info_show(struct seq_file *seq, void *v)
+{
+	struct rpc_clnt *clnt = seq->private;
+	const struct rpc_timeout *timeout = clnt->cl_timeout;
+
+	seq_printf(seq, "cl_count: %d\n", refcount_read(&clnt->cl_count));
+	seq_printf(seq, "cl_pid: %d\n", atomic_read(&clnt->cl_pid));
+	seq_printf(seq, "cl_prog: %d\n", clnt->cl_prog);
+	seq_printf(seq, "cl_vers: %d\n", clnt->cl_vers);
+	seq_printf(seq, "cl_maxproc: %d\n", clnt->cl_maxproc);
+
+	seq_printf(seq, "cl_softrtry: %d\n", clnt->cl_softrtry);
+	seq_printf(seq, "cl_softerr: %d\n", clnt->cl_softerr);
+	seq_printf(seq, "cl_discrtry: %d\n", clnt->cl_discrtry);
+	seq_printf(seq, "cl_noretranstimeo: %d\n", clnt->cl_noretranstimeo);
+	seq_printf(seq, "cl_autobind: %d\n", clnt->cl_autobind);
+	seq_printf(seq, "cl_chatty: %d\n", clnt->cl_chatty);
+	seq_printf(seq, "cl_shutdown: %d\n", clnt->cl_shutdown);
+
+	seq_printf(seq, "cl_xprtsec: %d\n", clnt->cl_xprtsec.policy);
+	seq_printf(seq, "cl_rtt: timeo=%ld\n", clnt->cl_rtt->timeo);
+	seq_printf(seq, "cl_timeout: "
+		   "to_initval=%ld, to_maxval=%ld, to_increment=%ld, "
+		   "to_retries=%d, to_exponential=%d\n",
+		   timeout->to_initval, timeout->to_maxval,
+		   timeout->to_increment,
+		   timeout->to_retries, timeout->to_exponential);
+
+	seq_printf(seq, "cl_max_connect: %d\n", clnt->cl_max_connect);
+	seq_printf(seq, "cl_nodename: ");
+	seq_write(seq, clnt->cl_nodename, clnt->cl_nodelen);
+	seq_printf(seq, "\n");
+
+	return 0;
+}
+
+static int
+clnt_info_open(struct inode *inode, struct file *filp)
+{
+	int ret;
+	struct rpc_clnt *clnt = inode->i_private;
+
+	ret = single_open(filp, clnt_info_show, clnt);
+
+	if (!ret && !refcount_inc_not_zero(&clnt->cl_count)) {
+		single_release(inode, filp);
+		return -EINVAL;
+	}
+
+	return ret;
+}
+
+static int
+clnt_info_release(struct inode *inode, struct file *filp)
+{
+	struct seq_file *seq = filp->private_data;
+	struct rpc_clnt *clnt = seq->private;
+
+	rpc_release_client(clnt);
+	return seq_release(inode, filp);
+}
+
+static const struct file_operations info_fops = {
+	.owner		= THIS_MODULE,
+	.open		= clnt_info_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= clnt_info_release,
+};
+
 void
 rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
 {
@@ -160,6 +231,10 @@ rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
 	debugfs_create_file("tasks", S_IFREG | 0400, clnt->cl_debugfs, clnt,
 			    &tasks_fops);
 
+	/* make info file */
+	debugfs_create_file("info", S_IFREG | 0400, clnt->cl_debugfs, clnt,
+			    &info_fops);
+
 	rpc_clnt_iterate_for_each_xprt(clnt, do_xprt_debugfs, &xprtnum);
 }
 
-- 
2.39.3


-- 
Dan Aloni

             reply	other threads:[~2023-11-05 15:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 15:48 Dan Aloni [this message]
2023-11-07 13:46 ` mount options not propagating to NFSACL and NSM RPC clients Benjamin Coddington
2023-11-29 13:20   ` Dan Aloni
2023-11-30 14:30     ` Benjamin Coddington
2024-04-10 14:39       ` Dan Aloni
2024-04-11 15:20         ` Benjamin Coddington
2024-04-11 16:36           ` Dan Aloni
2024-04-11 18:20             ` Benjamin Coddington
2024-04-11 19:08             ` Trond Myklebust
2024-04-11 19:46               ` Dan Aloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231105154857.ryakhmgaptq3hb6b@gmail.com \
    --to=dan.aloni@vastdata.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).