From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever III <chuck.lever@oracle.com>,
Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Chuck Lever <cel@kernel.org>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
"lorenzo.bianconi@redhat.com" <lorenzo.bianconi@redhat.com>
Subject: Re: [RFC] NFSD: add rpc_status entry in nfsd debug filesystem
Date: Mon, 10 Jul 2023 12:36:35 -0400 [thread overview]
Message-ID: <ace2422233a24b7506f77e820e09c3500c617b10.camel@kernel.org> (raw)
In-Reply-To: <E916B0DD-7470-4F2C-A7F8-13DB070CC593@oracle.com>
On Mon, 2023-07-10 at 15:55 +0000, Chuck Lever III wrote:
>
> > On Jul 10, 2023, at 11:33 AM, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > > > + for (i = 0; i < serv->sv_nrpools; i++) {
> > > > + struct svc_rqst *rqstp;
> > > > +
> > > > + seq_puts(m, "XID | FLAGS | PROG |");
> > > > + seq_puts(m, " VERS | PROC\t|");
> > > > + seq_puts(m, " REMOTE - LOCAL IP ADDR");
> > > > + seq_puts(m, "\t\t\t\t\t\t\t\t | NFS4 COMPOUND OPS\n");
> > > > + list_for_each_entry_rcu(rqstp,
> > > > + &serv->sv_pools[i].sp_all_threads,
> > > > + rq_all) {
> > > > + if (!test_bit(RQ_BUSY, &rqstp->rq_flags))
> > > > + continue;
> > > > +
> > > > + seq_printf(m,
> > > > + "0x%08x | 0x%08lx | 0x%08x | NFSv%d | %s\t|",
> > > > + be32_to_cpu(rqstp->rq_xid), rqstp->rq_flags,
> > > > + rqstp->rq_prog, rqstp->rq_vers,
> > > > + svc_proc_name(rqstp));
> > > > +
> > > > + if (rqstp->rq_addr.ss_family == AF_INET) {
> > > > + seq_printf(m, " %pI4 - %pI4\t\t\t\t\t\t\t |",
> > > > + &((struct sockaddr_in *)&rqstp->rq_addr)->sin_addr,
> > > > + &((struct sockaddr_in *)&rqstp->rq_daddr)->sin_addr);
> > > > + } else if (rqstp->rq_addr.ss_family == AF_INET6) {
> > > > + seq_printf(m, " %pI6 - %pI6 |",
> > > > + &((struct sockaddr_in6 *)&rqstp->rq_addr)->sin6_addr,
> > > > + &((struct sockaddr_in6 *)&rqstp->rq_daddr)->sin6_addr);
> > > > + } else {
> > > > + seq_printf(m, " Unknown address family: %hu\n",
> > > > + rqstp->rq_addr.ss_family);
> > > > + continue;
> > > > + }
> > > > +#ifdef CONFIG_NFSD_V4
> > > > + if (rqstp->rq_vers == NFS4_VERSION &&
> > > > + rqstp->rq_proc == NFSPROC4_COMPOUND) {
> > > > + /* NFSv4 compund */
> > > > + struct nfsd4_compoundargs *args = rqstp->rq_argp;
> > > > + struct nfsd4_compoundres *resp = rqstp->rq_resp;
> > > > +
> > > > + while (resp->opcnt < args->opcnt) {
> > > > + struct nfsd4_op *op = &args->ops[resp->opcnt++];
> > > > +
> > > > + seq_printf(m, " %s", nfsd4_op_name(op->opnum));
> > > > + }
> > > > + }
> > > > +#endif /* CONFIG_NFSD_V4 */
> > > > + seq_puts(m, "\n");
> > >
> > > My only quibble here is that the file format needs to be parsable
> > > by scripts as well as readable by humans. I'm not sure I have a
> > > specific comment, but it's something that needs some attention and
> > > verification (with, say, a sample user space tool, hint hint).
> >
> > maybe we can add a csv hanlder, what do you think? not sure.
>
> I suggested JSON to Jeff as another option, but I don't think we want
> to swing that far in the other direction.
>
> There are plenty of examples of /sys files that are both parsable and
> human-friendly. I'll leave it to you to find one or two formats that
> seem capable of the task at hand, and let's pick from one of those.
>
Are there already kernel libraries for this, or any examples of kernel
interfaces that emit JSON? Most of the kernel interfaces I have
experience with just use well-known fields delimited by spaces.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2023-07-10 16:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 10:17 [RFC] NFSD: add rpc_status entry in nfsd debug filesystem Lorenzo Bianconi
2023-06-29 11:10 ` Jeff Layton
2023-07-10 15:14 ` Lorenzo Bianconi
2023-06-29 13:55 ` Chuck Lever
2023-06-29 21:52 ` Chuck Lever
2023-07-10 16:18 ` Lorenzo Bianconi
2023-07-10 15:33 ` Lorenzo Bianconi
2023-07-10 15:55 ` Chuck Lever III
2023-07-10 16:19 ` Lorenzo Bianconi
2023-07-10 16:36 ` Jeff Layton [this message]
2023-07-10 16:39 ` Chuck Lever III
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=ace2422233a24b7506f77e820e09c3500c617b10.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@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