Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4966731rwb; Mon, 31 Jul 2023 15:45:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlHrVgu+bjwpNJpy7iSeVGO4w/qAjpGuAp4HJEkg9EuK9ml4A2o42RJDbYKT+dnRGh7/ySic X-Received: by 2002:a17:906:3f1c:b0:99b:4174:77f6 with SMTP id c28-20020a1709063f1c00b0099b417477f6mr795178ejj.33.1690843549673; Mon, 31 Jul 2023 15:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690843549; cv=none; d=google.com; s=arc-20160816; b=AAD1H/ZSTGeHuI0fnf0timCV4JuipiArH0nbNnlZfVbkcWmtef9ouTgdHelirSDUYh /UCnA4ilV9BR5TDE8JHad/kCsIYeIzFuUrJvR1wDTiJh2cXqth30HQpe7TqZ88ymAnBh 0Hwbm8svAoGwm/rwaejdx9lh5B4L4HIjiBGX+6VsrTRBRLKj3Kv2bKDdmiqFvLP8r4B2 3prekFpLnCI79+FIbP5r1pCXnghYuHIQwpOUWeiob/s4gOW4KdpCdLW9RFA0u0r9WDCJ T4qxNwl1F8xJn7Osjq2MyY94N25QK5vdjA9PEk7UjJmqJr2m59OYwpAGAzmKnnSSJTHy V7BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=mNS3V/2grMP0yG96HXAVD+rwC4dfDVur5DHPovpj+uw=; fh=u0ORG9RnNSrv+4IWX3LWZSFKWctJDyOxwTbj2bcNXj4=; b=OV9He/gcaqfAXc/yMK31W2jLnN8uTfAgawY9HUDqujss+n9Hv6U6fMxg2TorEfahZj 11HmjzdqEx9fhvEEvX3Q6ZsdiQPYpzBKz+Tf+dODrFxd3/grp14w0V4GfaCg3CPB0KeO XY1dG9I4z99Y4gKfo6HWRMz4k5YKxoQUUPqiWTQt4bNXPLRlTtlHKV8DUmJlEU2hyEQ1 5eoN18PqTptsnjnaHkWa2rZOEqMJUDJV2qmZfv9pZIlGKj8eGSyijkWOwFAjyPSmkcAS +TqqV347cIrWhbuKSVw4h0i4JYsAahzNCIyeF3Td83dc+v25mBfLAHnvAlJ2zOp/aAsj qvVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Rg8kbnhD; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a26-20020a1709065f9a00b0099bc8c11d20si4467865eju.248.2023.07.31.15.45.25; Mon, 31 Jul 2023 15:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Rg8kbnhD; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjGaWPU (ORCPT + 99 others); Mon, 31 Jul 2023 18:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjGaWPT (ORCPT ); Mon, 31 Jul 2023 18:15:19 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7E6B2 for ; Mon, 31 Jul 2023 15:15:17 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9FC2D21FD4; Mon, 31 Jul 2023 22:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690841716; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mNS3V/2grMP0yG96HXAVD+rwC4dfDVur5DHPovpj+uw=; b=Rg8kbnhDi3ow5U58dDtQex//DPJUBsT3oBnUP0w1efkx6BTjHoJelYsO8egokGpOZrI8qk Wrq905Yr6LJQg2mkBMKt5ivwG8FzQAR8UqgHTTtBfRiI0riPihKzropenXzniB4z+713vR pD8Ss9YTAjWkpSngmh6MJYoKnc/U/Cs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690841716; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mNS3V/2grMP0yG96HXAVD+rwC4dfDVur5DHPovpj+uw=; b=MFa4qAGAIrsZf0aCqhvj3ZOq378RAPSnHk9p7eUCDtbB27m9uPbgmuqWqZu08G8W6srg8Z lL3rGR3k0+jqytCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BCD8A133F7; Mon, 31 Jul 2023 22:15:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JmenG3IyyGTaJAAAMHmgww (envelope-from ); Mon, 31 Jul 2023 22:15:14 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: "Lorenzo Bianconi" , linux-nfs@vger.kernel.org, lorenzo.bianconi@redhat.com, chuck.lever@oracle.com Subject: Re: [PATCH v4 1/2] SUNRPC: add verbose parameter to __svc_print_addr() In-reply-to: References: , <5b0eff4e3ef9bf9621f5095189933f60def40f0d.1690569488.git.lorenzo@kernel.org>, <169058239308.32308.14184895022271604035@noble.neil.brown.name>, Date: Tue, 01 Aug 2023 08:15:11 +1000 Message-id: <169084171153.32308.15857155053964820267@noble.neil.brown.name> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, 01 Aug 2023, Jeff Layton wrote: > On Sat, 2023-07-29 at 08:13 +1000, NeilBrown wrote: > > On Sat, 29 Jul 2023, Lorenzo Bianconi wrote: > > > Introduce verbose parameter to utility routine in order to reduce output > > > verbosity. This is a preliminary patch to add rpc_status entry in nfsd > > > debug filesystem in order to dump pending RPC requests debugging > > > information. > > >=20 > > > Signed-off-by: Lorenzo Bianconi > > > --- > > > include/linux/sunrpc/svc_xprt.h | 12 ++++++------ > > > net/sunrpc/svc_xprt.c | 2 +- > > > 2 files changed, 7 insertions(+), 7 deletions(-) > > >=20 > > > diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc= _xprt.h > > > index a6b12631db21..1715d4c6bd6b 100644 > > > --- a/include/linux/sunrpc/svc_xprt.h > > > +++ b/include/linux/sunrpc/svc_xprt.h > > > @@ -209,21 +209,21 @@ static inline unsigned short svc_xprt_remote_port= (const struct svc_xprt *xprt) > > > } > > > =20 > > > static inline char *__svc_print_addr(const struct sockaddr *addr, > > > - char *buf, const size_t len) > > > + char *buf, const size_t len, > > > + bool verbose) > > > { > > > const struct sockaddr_in *sin =3D (const struct sockaddr_in *)addr; > > > const struct sockaddr_in6 *sin6 =3D (const struct sockaddr_in6 *)addr; > > > =20 > > > switch (addr->sa_family) { > > > case AF_INET: > > > - snprintf(buf, len, "%pI4, port=3D%u", &sin->sin_addr, > > > - ntohs(sin->sin_port)); > > > + snprintf(buf, len, "%pI4, %s%u", &sin->sin_addr, > > > + verbose ? "port=3D" : "", ntohs(sin->sin_port)); > >=20 > > I would move the "," into the verbose part too. > > so > > verbose ? ", port=3D" : " " > >=20 > > Other than that, I like this approach. > >=20 >=20 > If we're separating fields in the main seqfile by ' ', then we probably > want to use a different delimiter here in the !verbose case. Maybe ':' > or ',' instead? Aren't the address and the port two different fields? Colon is normal for separating host and port, but as IPv6 addresses contain colons, you would need [IP::V6]:port which is probably isn't really an improvement. I would leave address and port as separate fields. >=20 > Also, ntohs is going to return a short, so the format should probably be > using "%hu" for the port. Probably. Thanks, NeilBrown >=20 > >=20 > > > break; > > > =20 > > > case AF_INET6: > > > - snprintf(buf, len, "%pI6, port=3D%u", > > > - &sin6->sin6_addr, > > > - ntohs(sin6->sin6_port)); > > > + snprintf(buf, len, "%pI6, %s%u", &sin6->sin6_addr, > > > + verbose ? "port=3D" : "", ntohs(sin6->sin6_port)); > > > break; > > > =20 > > > default: > > > diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c > > > index 62c7919ea610..16b794d291a4 100644 > > > --- a/net/sunrpc/svc_xprt.c > > > +++ b/net/sunrpc/svc_xprt.c > > > @@ -386,7 +386,7 @@ EXPORT_SYMBOL_GPL(svc_xprt_copy_addrs); > > > */ > > > char *svc_print_addr(struct svc_rqst *rqstp, char *buf, size_t len) > > > { > > > - return __svc_print_addr(svc_addr(rqstp), buf, len); > > > + return __svc_print_addr(svc_addr(rqstp), buf, len, true); > > > } > > > EXPORT_SYMBOL_GPL(svc_print_addr); > > > =20 > > > --=20 > > > 2.41.0 > > >=20 > > >=20 > >=20 >=20 > --=20 > Jeff Layton >=20