From patchwork Thu Jul 29 20:59:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12409837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07E63C4320A for ; Thu, 29 Jul 2021 20:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D84DC60F46 for ; Thu, 29 Jul 2021 20:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233086AbhG2U7z (ORCPT ); Thu, 29 Jul 2021 16:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbhG2U7y (ORCPT ); Thu, 29 Jul 2021 16:59:54 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA05BC0613C1 for ; Thu, 29 Jul 2021 13:59:50 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id f22so7348728qke.10 for ; Thu, 29 Jul 2021 13:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rQ87HFGJygj9MSqYTR0hscBamCmFUciEElaDGRe1T6g=; b=mW7DF7DTUdRZmJYDN0gbINOQFFYddiKE67XjBJgtrh2sGZnLYt5E7IMFwvo28xAFMC Yxcnxfg4EX+ULt6Ra00quP5csdRmm5ZJusJFWELwngHffXhwMtRU+0cWKXb5V0nMFPwz 1W0zONd/4G4hj1n6SGFISG7s4PF8fiGUi0rc0IhVzl9tpSvIYXCr10EaAbgIUwmEmQxG e+0r4ASsVku+vxrA/8S9qt3QjexD9d6PT98R8mSLDeDpZUZTOIBXnOkXxN5z/6c4QzP5 Jl135uYtWM3CeoTIgW2gyCvuUC/ItLamIZoR2ujK9iTNZVRphfL2j4MnSZQWL99sYX1z f47g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rQ87HFGJygj9MSqYTR0hscBamCmFUciEElaDGRe1T6g=; b=DSIDS/HDm0Sfx56sFJA1T+Tau5RVemXSQtcN1STKW/bWs67LizQjH8rZCUkbDjBewZ /rUzm1tvTByI6rtaHPp8iBryaIPoWST2z1buHHEQm+LBpoAUo5B6SOTNSvc4Cve9Mup2 vpr16RFk74H5W4aK7USkuWmmZd9NUHsEFQS9QvIFtQexZ1vjXQbCD2ADL6L5DJs4zzvc Kc+GnvF6Qj4dHW9pydTkYjdZsyqk04sPwv+REKKv43zbxIqhrUnnFAM0QSh77wlDA3nN Krw+EMURolsXHdbuC768036BLv1JYMb517gDDD0RSqiKMd5fJYbCXubGG1lnSISO1X2R RYEg== X-Gm-Message-State: AOAM530fQwDg5pDYO8uoKwlvGOSronKkUdVfxMLSgCHMm92ZkPkn2Onf +R//NMNDWd2O3UI+ZlwTBl4= X-Google-Smtp-Source: ABdhPJxgmF+oKFR+RHGddAwp4naUdZMipqdXW7I3YyOnLXIxb9wlVHfn+5EX364PwSGDxrdf5OZKYw== X-Received: by 2002:a05:620a:14b8:: with SMTP id x24mr7287639qkj.475.1627592389953; Thu, 29 Jul 2021 13:59:49 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id j3sm2268529qka.96.2021.07.29.13.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 13:59:49 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 1/2] SUNRPC: Add srcaddr as a file in sysfs Date: Thu, 29 Jul 2021 16:59:46 -0400 Message-Id: <20210729205947.162599-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210729205947.162599-1-Anna.Schumaker@Netapp.com> References: <20210729205947.162599-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker I don't support changing it right now, but it could be useful information for clients with multiple network cards. Signed-off-by: Anna Schumaker --- net/sunrpc/sysfs.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 64da3bfd28e6..2e7a53504974 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -100,6 +100,28 @@ static ssize_t rpc_sysfs_xprt_dstaddr_show(struct kobject *kobj, return ret + 1; } +static ssize_t rpc_sysfs_xprt_srcaddr_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + struct rpc_xprt *xprt = rpc_sysfs_xprt_kobj_get_xprt(kobj); + struct sockaddr_storage saddr; + struct sock_xprt *sock; + ssize_t ret = -1; + + if (!xprt) + return 0; + + sock = container_of(xprt, struct sock_xprt, xprt); + if (kernel_getsockname(sock->sock, (struct sockaddr *)&saddr) < 0) + goto out; + + ret = sprintf(buf, "%pISc\n", &saddr); +out: + xprt_put(xprt); + return ret + 1; +} + static ssize_t rpc_sysfs_xprt_info_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -376,6 +398,9 @@ static const void *rpc_sysfs_xprt_namespace(struct kobject *kobj) static struct kobj_attribute rpc_sysfs_xprt_dstaddr = __ATTR(dstaddr, 0644, rpc_sysfs_xprt_dstaddr_show, rpc_sysfs_xprt_dstaddr_store); +static struct kobj_attribute rpc_sysfs_xprt_srcaddr = __ATTR(srcaddr, + 0644, rpc_sysfs_xprt_srcaddr_show, NULL); + static struct kobj_attribute rpc_sysfs_xprt_info = __ATTR(xprt_info, 0444, rpc_sysfs_xprt_info_show, NULL); @@ -384,6 +409,7 @@ static struct kobj_attribute rpc_sysfs_xprt_change_state = __ATTR(xprt_state, static struct attribute *rpc_sysfs_xprt_attrs[] = { &rpc_sysfs_xprt_dstaddr.attr, + &rpc_sysfs_xprt_srcaddr.attr, &rpc_sysfs_xprt_info.attr, &rpc_sysfs_xprt_change_state.attr, NULL, From patchwork Thu Jul 29 20:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12409839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D6FC432BE for ; Thu, 29 Jul 2021 20:59:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EA5660EC0 for ; Thu, 29 Jul 2021 20:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233129AbhG2U74 (ORCPT ); Thu, 29 Jul 2021 16:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbhG2U74 (ORCPT ); Thu, 29 Jul 2021 16:59:56 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08B66C061765 for ; Thu, 29 Jul 2021 13:59:52 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id 184so7383575qkh.1 for ; Thu, 29 Jul 2021 13:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cuhQ2h40XFn8maWZ+fhgOap2rvIGruMHRWRFAKpE1r4=; b=hI73O2XyFw/dWa7eDCgBcjvx7yDB2u+Z2kU11WfbS9B7Yg1l3cxo/aAIWtvus20spS bZE+NsJWVvwIUErvcMI38xK+CH+y9SeJJVSxm8vviEzkTm98qSI20XErNW3LPQFrhZlV ox5r3tbZid+hDmR6vcRRNz3r/VL+Gayu8CqJe5dzyZiYnKxYqerYpTVK07ZlnFxBPEhl dQ4edNxq/HD2Uusr93Rbe43r5EqlB/dDjDiCCFfInIyYM2uIJbe7rGnpqkRuHudDq0ys Y/eil1YzDpqOLfcUuP0c+NlSm0esQEMuq1NMVuSRC9DfvWmjFf2UIZL7OA0t2UqaJgQR SJ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cuhQ2h40XFn8maWZ+fhgOap2rvIGruMHRWRFAKpE1r4=; b=AfMcgAbeXcWiTWyfjCsBoSL/6PYE/YvnHk/4iq/Gs8WY7mPbul+4wPEvCxiE6CQDhc I3gGGGQE8++psXmDoWTdgs+LmdNC7Zjstjw+uD3J/KNyOTHs7OgO9j+p1NSUSp+evrX1 Omf/xXMdpT8g/lwI6LHaOWjqFMyiXTukRmHkt4QwUCKG8LBGErXXlrWDEBJ9b40kG3UD 2W8S56EJ83Q78RKfFXXRFsqqnDsOie//gzxwDYhQimfCbD8NiIMx8PKA4ikx16du661x FljhgvcM0oEAxYx8Kyfb8FDpp4txdffraa8697PsMAs+/LQVdszS7OJryhm4keW/4j3n JUiA== X-Gm-Message-State: AOAM532middkWsKO7n8Y8vfyy/BHUnXxn2banhrkeJg4DvZRgswfXRvR a7pEY8FUi5hr9s1RlL80UBM= X-Google-Smtp-Source: ABdhPJzOWs4ZvCDYrK4G/PWNslYGoobvL6P46JoycYW0mfnHN8oCCQwVVfqTDYK+6ym/DkQ0bmLqFA== X-Received: by 2002:a37:618a:: with SMTP id v132mr7276887qkb.382.1627592391151; Thu, 29 Jul 2021 13:59:51 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id j3sm2268529qka.96.2021.07.29.13.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 13:59:50 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 2/2] SUNRPC: Add dst_port to the sysfs xprt info file Date: Thu, 29 Jul 2021 16:59:47 -0400 Message-Id: <20210729205947.162599-3-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210729205947.162599-1-Anna.Schumaker@Netapp.com> References: <20210729205947.162599-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This is most likely going to be 2049 for NFS, but some servers might be configured to export on a non-standard port. Let's show this information just in case somebody needs it. Signed-off-by: Anna Schumaker --- net/sunrpc/sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 2e7a53504974..414c664a3199 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -136,14 +136,16 @@ static ssize_t rpc_sysfs_xprt_info_show(struct kobject *kobj, "max_num_slots=%u\nmin_num_slots=%u\nnum_reqs=%u\n" "binding_q_len=%u\nsending_q_len=%u\npending_q_len=%u\n" "backlog_q_len=%u\nmain_xprt=%d\nsrc_port=%u\n" - "tasks_queuelen=%ld\n", + "tasks_queuelen=%ld\ndst_port=%s\n", xprt->last_used, xprt->cong, xprt->cwnd, xprt->max_reqs, xprt->min_reqs, xprt->num_reqs, xprt->binding.qlen, xprt->sending.qlen, xprt->pending.qlen, xprt->backlog.qlen, xprt->main, (xprt->xprt_class->ident == XPRT_TRANSPORT_TCP) ? get_srcport(xprt) : 0, - atomic_long_read(&xprt->queuelen)); + atomic_long_read(&xprt->queuelen), + (xprt->xprt_class->ident == XPRT_TRANSPORT_TCP) ? + xprt->address_strings[RPC_DISPLAY_PORT] : "0"); xprt_put(xprt); return ret + 1; }