Re: [RFC] NFSD: add rpc_status entry in nfsd debug filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jul 10, 2023, at 12:36 PM, Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> 
> On Mon, 2023-07-10 at 15:55 +0000, Chuck Lever III wrote:
>> 
>>> On Jul 10, 2023, at 11:33 AM, Lorenzo Bianconi <lorenzo@xxxxxxxxxx> 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.

As I said, I don't think we need to go with a heavily structured
format. JSON was just "yet another crazy idea."

Other /sys files seem to strike a sensible balance, so let's research
what's already in use first.


--
Chuck Lever






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux