From patchwork Thu Jul 21 22:07:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FB07CCA485 for ; Thu, 21 Jul 2022 22:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbiGUWHU (ORCPT ); Thu, 21 Jul 2022 18:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231761AbiGUWHU (ORCPT ); Thu, 21 Jul 2022 18:07:20 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E886B93C25 for ; Thu, 21 Jul 2022 15:07:18 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id p81so2445553iod.2 for ; Thu, 21 Jul 2022 15:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zm65GAC++NE5htCbklv3UxxIt3spNpISQjRrzlmkFBM=; b=BOZZyrXonGsS7ADll1NTuWFhuv4Ig1yuXuZfLtsTnNrR1c1V2LYrQuyXPtDrg6DXD+ qItWVTtlFXbb+CC4yXahpu3iaurnM6ZkOVlRyzpyrljO95fs3nbxYHKwOxiPtZqHGL8+ 3M6qalK+250iVghpSz7jR1nvygALsD0ITsewN2JscR1P++pgc7gpj13zreBfCF3eXuOI y9pfMQnFIkRqy3xhkH7VElgl5hmRQWYNaTd2s3mP2+qhPq3k5YiWemTvIARIBZi3dBDz 6gi1MLIRv9HL4QZvZb6Nu/D/XN0shVspZtWihHY66cAGygmF6+QKoD78H3dwBAGYKirN KgXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zm65GAC++NE5htCbklv3UxxIt3spNpISQjRrzlmkFBM=; b=31ij5n46muwFn25aeusv3lHDSntJIgH0Nv4UzE0DLETKWx7O+bPOr/wvl4Js6XKKYE temYQCa+ofzLFGBha78MERdUpA4L3VioJ2Wci2GypVWY3GHSFmcCTCQmWuz0FDGTMVVI AO6ZNYxL5Ny6RunBjmUQWkLAvadZb+Ui+KP7xnk11d2hzizPCs8epTXLd+fxBV8fGG6+ ddmQlQS1mW3mGUkGNQmlJj3MfdH8iR0w4bbUZszB23Yydj+RAhOj6tWbsZRfrul9OjrU RNrYFz4PHQqoxUFJcpSFSrhbRp9L7VptmkfyL8bFevmEw/1lOKKPSJQiM6/STovtiot1 u0Mg== X-Gm-Message-State: AJIora/miOlpW03VrC9WclLILKiNR/Mk6R22dDDPwoxSny1D50dowIye aGjykmbGA8ISK5OnzQ/mwVM= X-Google-Smtp-Source: AGRyM1sWpRlM/BzgrtmEWNEbhAvjPKT41VeISoZ+FxTNe/SnFmZKDXZaCrWSGqJZIfMIiB7X3IsJWg== X-Received: by 2002:a05:6602:2c13:b0:669:7f63:a2d7 with SMTP id w19-20020a0566022c1300b006697f63a2d7mr212933iov.169.1658441238328; Thu, 21 Jul 2022 15:07:18 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:17 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 01/11] SUNRPC expose functions for offline remote xprt functionality Date: Thu, 21 Jul 2022 18:07:04 -0400 Message-Id: <20220721220714.22620-2-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Re-arrange the code that make offline transport and delete transport callable functions. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/xprt.h | 3 +++ net/sunrpc/sysfs.c | 28 +++++----------------------- net/sunrpc/xprt.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 522bbf937957..0d51b9f9ea37 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -505,4 +505,7 @@ static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) return test_and_set_bit(XPRT_BINDING, &xprt->state); } +void xprt_set_offline_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps); +void xprt_set_online_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps); +void xprt_delete_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps); #endif /* _LINUX_SUNRPC_XPRT_H */ diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index a3a2f8aeb80e..7330eb9a70cf 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -314,32 +314,14 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kobject *kobj, goto release_tasks; } if (offline) { - if (!test_and_set_bit(XPRT_OFFLINE, &xprt->state)) { - spin_lock(&xps->xps_lock); - xps->xps_nactive--; - spin_unlock(&xps->xps_lock); - } + xprt_set_offline_locked(xprt, xps); } else if (online) { - if (test_and_clear_bit(XPRT_OFFLINE, &xprt->state)) { - spin_lock(&xps->xps_lock); - xps->xps_nactive++; - spin_unlock(&xps->xps_lock); - } + xprt_set_online_locked(xprt, xps); } else if (remove) { - if (test_bit(XPRT_OFFLINE, &xprt->state)) { - if (!test_and_set_bit(XPRT_REMOVE, &xprt->state)) { - xprt_force_disconnect(xprt); - if (test_bit(XPRT_CONNECTED, &xprt->state)) { - if (!xprt->sending.qlen && - !xprt->pending.qlen && - !xprt->backlog.qlen && - !atomic_long_read(&xprt->queuelen)) - rpc_xprt_switch_remove_xprt(xps, xprt); - } - } - } else { + if (test_bit(XPRT_OFFLINE, &xprt->state)) + xprt_delete_locked(xprt, xps); + else count = -EINVAL; - } } release_tasks: diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 86d62cffba0d..8f8e3c952f24 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -2152,3 +2152,35 @@ void xprt_put(struct rpc_xprt *xprt) kref_put(&xprt->kref, xprt_destroy_kref); } EXPORT_SYMBOL_GPL(xprt_put); + +void xprt_set_offline_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps) +{ + if (!test_and_set_bit(XPRT_OFFLINE, &xprt->state)) { + spin_lock(&xps->xps_lock); + xps->xps_nactive--; + spin_unlock(&xps->xps_lock); + } +} + +void xprt_set_online_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps) +{ + if (test_and_clear_bit(XPRT_OFFLINE, &xprt->state)) { + spin_lock(&xps->xps_lock); + xps->xps_nactive++; + spin_unlock(&xps->xps_lock); + } +} + +void xprt_delete_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps) +{ + if (test_and_set_bit(XPRT_REMOVE, &xprt->state)) + return; + + xprt_force_disconnect(xprt); + if (!test_bit(XPRT_CONNECTED, &xprt->state)) + return; + + if (!xprt->sending.qlen && !xprt->pending.qlen && + !xprt->backlog.qlen && !atomic_long_read(&xprt->queuelen)) + rpc_xprt_switch_remove_xprt(xps, xprt); +} From patchwork Thu Jul 21 22:07:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5326C43334 for ; Thu, 21 Jul 2022 22:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbiGUWHV (ORCPT ); Thu, 21 Jul 2022 18:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiGUWHU (ORCPT ); Thu, 21 Jul 2022 18:07:20 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48AB93C2B for ; Thu, 21 Jul 2022 15:07:19 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id l24so2420293ion.13 for ; Thu, 21 Jul 2022 15:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tv7+BXQfUtmPW8f36OVJmuLUqqT8kBfIbwZL2xjHZaw=; b=YdrxKhRbMyJUYP71zewWvp0/hgCpjzLsC29WM60TnSb7YDOhhMMdQvUXs90Ly04Y3o oQl+bgB3oSURT8wf2RfpCwnV8h7//Rzqg2UxO/aghKsrRucD6L//vYjjvaX3thTsMpbI qENUKs4cgetzFW9PHLZ5m3cRM/PJbIKQuHUhqfxcjoS0+x8yljwpeIxLMiA/yQJB2DQd +HJrLO0W0f1fakbV406tSa6B5h+X/sk8D3iDpZNZ9bTQpttQmCLwRZmlMh1Q5xyyw1J9 WLeaHuE24RbSnsIvJE7Jbo14pHzK4wugnjPjy3AJMdTeY3TlaThZsF6dhsvLhrdot/yU 5TMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tv7+BXQfUtmPW8f36OVJmuLUqqT8kBfIbwZL2xjHZaw=; b=3HMA0I3K0xjRInzEIJlFn1CRQU55vxa/V+1goB2gp1835KSFvkD0TfB4RMslkSjUl6 JkLbp203PC1gebr9+OCUHGKd50TdfAPeTBinh9likMOzE21RaVuGaQYWfNFjn+SC7ZlP 6xQww4hezZOMDg4NKEV7YqwUETBU0Y+oZuZMOVi5L334vICmD9GUK5hgKbYtlRmEtq4+ nxLb2xBgoclvatvflrXnbVVuLfsBPoOBUTuxFtm6RCegfmvYrVGxOuNv1a5piZCD5+9w kZ2L7VWL59pAuOGOqNiC6eHVXxoX6Hqf0CcjQsn/czywAeE4+AzRn3DQekkT9SdZekcX u3/Q== X-Gm-Message-State: AJIora+BxEmsWnxXohe+V4vgEHy7Ez9+Hago0QkvsQmE1e63jLvCf/pV HS0At5V1kMgbwWeRHUw6B7k= X-Google-Smtp-Source: AGRyM1tMcV7mt6oVs3kxT3BlFqbfd/TO88bPU/Ed9zep/nsTJ95hRtWM7wXRASVABbfDizex94WjcQ== X-Received: by 2002:a05:6602:2d16:b0:67c:1472:815e with SMTP id c22-20020a0566022d1600b0067c1472815emr213399iow.86.1658441239438; Thu, 21 Jul 2022 15:07:19 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:18 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 02/11] SUNRPC add function to offline remove trunkable transports Date: Thu, 21 Jul 2022 18:07:05 -0400 Message-Id: <20220721220714.22620-3-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Iterate thru available transports in the xprt_switch for all trunkable transports offline and possibly remote them as well. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/clnt.c | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 90501404fa49..d14333f4947a 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -234,6 +234,7 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *, struct rpc_xprt_switch *, struct rpc_xprt *, void *); +void rpc_clnt_manage_trunked_xprts(struct rpc_clnt *); const char *rpc_proc_name(const struct rpc_task *task); diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index b6781ada3aa8..6417ccc283f4 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -3000,6 +3000,52 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, } EXPORT_SYMBOL_GPL(rpc_clnt_add_xprt); +static int rpc_xprt_offline(struct rpc_clnt *clnt, + struct rpc_xprt *xprt, + void *data) +{ + struct rpc_xprt *main_xprt; + struct rpc_xprt_switch *xps; + int err = 0; + + xprt_get(xprt); + + rcu_read_lock(); + main_xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); + xps = xprt_switch_get(rcu_dereference(clnt->cl_xpi.xpi_xpswitch)); + err = rpc_cmp_addr_port((struct sockaddr *)&xprt->addr, + (struct sockaddr *)&main_xprt->addr); + rcu_read_unlock(); + xprt_put(main_xprt); + if (err) + goto out; + + if (wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_KILLABLE)) { + err = -EINTR; + goto out; + } + xprt_set_offline_locked(xprt, xps); + + xprt_release_write(xprt, NULL); +out: + xprt_put(xprt); + xprt_switch_put(xps); + return err; +} + +/* rpc_clnt_manage_trunked_xprts -- offline trunked transports + * @clnt rpc_clnt structure + * + * For each active transport found in the rpc_clnt structure call + * the function rpc_xprt_offline() which will identify trunked transports + * and will mark them offline. + */ +void rpc_clnt_manage_trunked_xprts(struct rpc_clnt *clnt) +{ + rpc_clnt_iterate_for_each_xprt(clnt, rpc_xprt_offline, NULL); +} +EXPORT_SYMBOL_GPL(rpc_clnt_manage_trunked_xprts); + struct connect_timeout_data { unsigned long connect_timeout; unsigned long reconnect_timeout; From patchwork Thu Jul 21 22:07:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FE91CCA485 for ; Thu, 21 Jul 2022 22:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbiGUWHW (ORCPT ); Thu, 21 Jul 2022 18:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiGUWHV (ORCPT ); Thu, 21 Jul 2022 18:07:21 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24BF093C25 for ; Thu, 21 Jul 2022 15:07:21 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id q2so954089ilv.4 for ; Thu, 21 Jul 2022 15:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KMTLbdj5i3kARc8Yruolj18QKT6xCIBawJHHHx0dEl0=; b=Ei+C/n1YSnW8SD7gH8po9nOxCXP0S6MheqZfcWaDxQSU5Oz4QPZAeVYBT5aSWqM2MZ QYcL7uy44oOHVxe+IOLyqdzGhTRbKtrvCiADUbGJ02pb/ZKGJVgeeDGKHdU9sQGkoVv6 r7fZ3j9LilAaJfesw5U8moaDc+CYyNuAe/b7yJzPX79uvvp4MnXexYD7AZf9UMM0Urpm QDQ2kdoAA2GmO790ipqWWFNUaZ0TkkkcbuLDF05Vfh+JJZ255DJlDLAH6zC6lU6dSIoN sgXxutMyss2Km8t1bgykBDWKpKSj3EbKlNwcWVt/WcYbKyGbCtEqW1ezj0Kd3Z7oS7su yqRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KMTLbdj5i3kARc8Yruolj18QKT6xCIBawJHHHx0dEl0=; b=PwFUQM0xHv/kWMVN/3eA2eQvelbOgtezsKogx7N5dofRmosNTkBNEITW48hLR36tpT CIj67AqC5BiwJlTVLIKNZIlNf7wpIA4uaiI6RrM3XBO6LuQC8khTIjSHhElNAEYdaD/V KOfJmoVzykjsYvwf+7YzL8cFxi53muyGdOZGyhNfchpEMnFlXfMWIgDmEZ2NPq988Wxt /hAuZ/gpNRB9FHwTdkgAzFjwJxVg9vKMVaZgHLZhXbhFpeK6k4T9pduMAhR8tCusX2jc pZI+MwDVLqyoYpP/+v+cqXDWEOSV9fRXwPGqht/88vsAfevzCKq8jK5WzVco0oEfGccI DJvw== X-Gm-Message-State: AJIora8kTbYJluFAGsDnUb2NZRz40J5TVg8IWjccsKv4iEYNIC+1UGnR T1aAB9qJkaeAdUKeI3+WjsY= X-Google-Smtp-Source: AGRyM1uFN6ikur0KGqqXW27Ze3Qz3SbVKw8eikOk8LNxAnLbXzSAx9EofLtFWH8/hATHFxizt76iXA== X-Received: by 2002:a05:6e02:1d19:b0:2dd:1c61:c8ca with SMTP id i25-20020a056e021d1900b002dd1c61c8camr178381ila.49.1658441240511; Thu, 21 Jul 2022 15:07:20 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:20 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 03/11] NFSv4.1 offline trunkable transports on DESTROY_SESSION Date: Thu, 21 Jul 2022 18:07:06 -0400 Message-Id: <20220721220714.22620-4-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org When session is destroy, some of the transports might no longer be valid trunks for the new session. Offline existing transports. Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index bb0e84a46d61..9ae7d792beee 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9293,6 +9293,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session, if (status) dprintk("NFS: Got error %d from the server on DESTROY_SESSION. " "Session has been destroyed regardless...\n", status); + rpc_clnt_manage_trunked_xprts(session->clp->cl_rpcclient); return status; } From patchwork Thu Jul 21 22:07:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925806 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98DA4C433EF for ; Thu, 21 Jul 2022 22:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233441AbiGUWHX (ORCPT ); Thu, 21 Jul 2022 18:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbiGUWHX (ORCPT ); Thu, 21 Jul 2022 18:07:23 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6E08875F for ; Thu, 21 Jul 2022 15:07:22 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id u19so1519061ilk.7 for ; Thu, 21 Jul 2022 15:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tRwqEk/Tje8Bd1rVzX1MY35Msd1ee7K5czYsHF7UGI4=; b=CsUsCS7r4c5eANn+za7VEbf8kT4vwx552mdmEKGS7PuWePxA9lU7G8UoFmj+aKMa5N I9EXhV3BSjWYbdQhILrr4sTVNggmi56qNtk8ZibV8BtmMdQp6QuYwqI4SjZSqMRNA+pp OtxY5ipja4jXawJxqtteQByFRAFM0DMbkL2dpnBr5ghI9joi1Ui3b2wXlIz0/BUzODbF aBSjh/GcwcUrbmp7Z/0s4OLa0iP0yiS5vL2pp77yo0n4v1VsadWyasFnZiEnypqyXZ3B 7v3SXPzPB6vF1KRaUz4gez8F1euMePHa31h32God4qPFtc7irS4aY6pjbcNsY91xEBJd P/oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tRwqEk/Tje8Bd1rVzX1MY35Msd1ee7K5czYsHF7UGI4=; b=bXYXZ8AdYyxw2JMherI1RrnqXRzNtdf/U/jNOEi4rFv4+fpL/zDKYihBhJepIwo5yl oImhFWdSBDvRO0Um+5KEi39lOG/ErAPJ7QtDHtMj3iMnh6ASVuJX7NNuAa0z8la29OVC Zk9EF52mFwEVaqyDLt+ls37gm/RBANGmQ5zM8dUFlREc8wSopLypUoT+L7XsS4s9s3uC mswAjwHUlwc3uPtDU+mSgTK0TxtTRmbv/5kzm6JZPLzPvfb2xrjCbqpx9lP4YTPVippZ 19gzAnJoyNmX4cItCNX7w0rhV4Pa4Bgk5UEaXn2C9QnSv0nlVAWc4hXKvNnco/IEieGp NCPQ== X-Gm-Message-State: AJIora8mbpP1FsOHBRjgtP8VxrEP409aVzIdVEve4e1zxEbTwQkMtzE6 6UfNeg4sG5BKoYzO0ME4el4= X-Google-Smtp-Source: AGRyM1s5+KwhJkUNOXec/2ImWIG17+D5m2dQWvzSlV9sYvjCFTWK0xdIG2spSzFnFY86eJD5oNahBw== X-Received: by 2002:a92:ad07:0:b0:2db:ec23:909e with SMTP id w7-20020a92ad07000000b002dbec23909emr223035ilh.204.1658441241663; Thu, 21 Jul 2022 15:07:21 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:21 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 04/11] SUNRPC create an iterator to list only OFFLINE xprts Date: Thu, 21 Jul 2022 18:07:07 -0400 Message-Id: <20220721220714.22620-5-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Create a new iterator helper that will go thru the all the transports in the switch and return transports that are marked OFFLINE. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/xprtmultipath.h | 3 + net/sunrpc/clnt.c | 11 +++- net/sunrpc/xprtmultipath.c | 99 +++++++++++++++++++++++++--- 3 files changed, 101 insertions(+), 12 deletions(-) diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h index bbb8a5fa0816..688ca7eb1d01 100644 --- a/include/linux/sunrpc/xprtmultipath.h +++ b/include/linux/sunrpc/xprtmultipath.h @@ -63,6 +63,9 @@ extern void xprt_iter_init(struct rpc_xprt_iter *xpi, extern void xprt_iter_init_listall(struct rpc_xprt_iter *xpi, struct rpc_xprt_switch *xps); +extern void xprt_iter_init_listoffline(struct rpc_xprt_iter *xpi, + struct rpc_xprt_switch *xps); + extern void xprt_iter_destroy(struct rpc_xprt_iter *xpi); extern struct rpc_xprt_switch *xprt_iter_xchg_switch( diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 6417ccc283f4..ada45b3b1dad 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -786,7 +786,8 @@ int rpc_switch_client_transport(struct rpc_clnt *clnt, EXPORT_SYMBOL_GPL(rpc_switch_client_transport); static -int rpc_clnt_xprt_iter_init(struct rpc_clnt *clnt, struct rpc_xprt_iter *xpi) +int _rpc_clnt_xprt_iter_init(struct rpc_clnt *clnt, struct rpc_xprt_iter *xpi, + void func(struct rpc_xprt_iter *xpi, struct rpc_xprt_switch *xps)) { struct rpc_xprt_switch *xps; @@ -795,11 +796,17 @@ int rpc_clnt_xprt_iter_init(struct rpc_clnt *clnt, struct rpc_xprt_iter *xpi) rcu_read_unlock(); if (xps == NULL) return -EAGAIN; - xprt_iter_init_listall(xpi, xps); + func(xpi, xps); xprt_switch_put(xps); return 0; } +static +int rpc_clnt_xprt_iter_init(struct rpc_clnt *clnt, struct rpc_xprt_iter *xpi) +{ + return _rpc_clnt_xprt_iter_init(clnt, xpi, xprt_iter_init_listall); +} + /** * rpc_clnt_iterate_for_each_xprt - Apply a function to all transports * @clnt: pointer to client diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 1693f81aae37..8def8423fc0a 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -27,6 +27,7 @@ typedef struct rpc_xprt *(*xprt_switch_find_xprt_t)(struct rpc_xprt_switch *xps, static const struct rpc_xprt_iter_ops rpc_xprt_iter_singular; static const struct rpc_xprt_iter_ops rpc_xprt_iter_roundrobin; static const struct rpc_xprt_iter_ops rpc_xprt_iter_listall; +static const struct rpc_xprt_iter_ops rpc_xprt_iter_listoffline; static void xprt_switch_add_xprt_locked(struct rpc_xprt_switch *xps, struct rpc_xprt *xprt) @@ -248,6 +249,18 @@ struct rpc_xprt *xprt_switch_find_first_entry(struct list_head *head) return NULL; } +static +struct rpc_xprt *xprt_switch_find_first_entry_offline(struct list_head *head) +{ + struct rpc_xprt *pos; + + list_for_each_entry_rcu(pos, head, xprt_switch) { + if (!xprt_is_active(pos)) + return pos; + } + return NULL; +} + static struct rpc_xprt *xprt_iter_first_entry(struct rpc_xprt_iter *xpi) { @@ -259,8 +272,9 @@ struct rpc_xprt *xprt_iter_first_entry(struct rpc_xprt_iter *xpi) } static -struct rpc_xprt *xprt_switch_find_current_entry(struct list_head *head, - const struct rpc_xprt *cur) +struct rpc_xprt *_xprt_switch_find_current_entry(struct list_head *head, + const struct rpc_xprt *cur, + bool find_active) { struct rpc_xprt *pos; bool found = false; @@ -268,14 +282,25 @@ struct rpc_xprt *xprt_switch_find_current_entry(struct list_head *head, list_for_each_entry_rcu(pos, head, xprt_switch) { if (cur == pos) found = true; - if (found && xprt_is_active(pos)) + if (found && ((find_active && xprt_is_active(pos)) || + (!find_active && xprt_is_active(pos)))) return pos; } return NULL; } static -struct rpc_xprt *xprt_iter_current_entry(struct rpc_xprt_iter *xpi) +struct rpc_xprt *xprt_switch_find_current_entry(struct list_head *head, + const struct rpc_xprt *cur) +{ + return _xprt_switch_find_current_entry(head, cur, true); +} + +static +struct rpc_xprt * _xprt_iter_current_entry(struct rpc_xprt_iter *xpi, + struct rpc_xprt *first_entry(struct list_head *head), + struct rpc_xprt *current_entry(struct list_head *head, + const struct rpc_xprt *cur)) { struct rpc_xprt_switch *xps = rcu_dereference(xpi->xpi_xpswitch); struct list_head *head; @@ -284,8 +309,30 @@ struct rpc_xprt *xprt_iter_current_entry(struct rpc_xprt_iter *xpi) return NULL; head = &xps->xps_xprt_list; if (xpi->xpi_cursor == NULL || xps->xps_nxprts < 2) - return xprt_switch_find_first_entry(head); - return xprt_switch_find_current_entry(head, xpi->xpi_cursor); + return first_entry(head); + return current_entry(head, xpi->xpi_cursor); +} + +static +struct rpc_xprt *xprt_iter_current_entry(struct rpc_xprt_iter *xpi) +{ + return _xprt_iter_current_entry(xpi, xprt_switch_find_first_entry, + xprt_switch_find_current_entry); +} + +static +struct rpc_xprt *xprt_switch_find_current_entry_offline(struct list_head *head, + const struct rpc_xprt *cur) +{ + return _xprt_switch_find_current_entry(head, cur, false); +} + +static +struct rpc_xprt *xprt_iter_current_entry_offline(struct rpc_xprt_iter *xpi) +{ + return _xprt_iter_current_entry(xpi, + xprt_switch_find_first_entry_offline, + xprt_switch_find_current_entry_offline); } bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, @@ -310,7 +357,7 @@ bool rpc_xprt_switch_has_addr(struct rpc_xprt_switch *xps, static struct rpc_xprt *xprt_switch_find_next_entry(struct list_head *head, - const struct rpc_xprt *cur) + const struct rpc_xprt *cur, bool check_active) { struct rpc_xprt *pos, *prev = NULL; bool found = false; @@ -318,7 +365,12 @@ struct rpc_xprt *xprt_switch_find_next_entry(struct list_head *head, list_for_each_entry_rcu(pos, head, xprt_switch) { if (cur == prev) found = true; - if (found && xprt_is_active(pos)) + /* for request to return active transports return only + * active, for request to return offline transports + * return only offline + */ + if (found && ((check_active && xprt_is_active(pos)) || + (!check_active && !xprt_is_active(pos)))) return pos; prev = pos; } @@ -355,7 +407,7 @@ struct rpc_xprt *__xprt_switch_find_next_entry_roundrobin(struct list_head *head { struct rpc_xprt *ret; - ret = xprt_switch_find_next_entry(head, cur); + ret = xprt_switch_find_next_entry(head, cur, true); if (ret != NULL) return ret; return xprt_switch_find_first_entry(head); @@ -397,7 +449,14 @@ static struct rpc_xprt *xprt_switch_find_next_entry_all(struct rpc_xprt_switch *xps, const struct rpc_xprt *cur) { - return xprt_switch_find_next_entry(&xps->xps_xprt_list, cur); + return xprt_switch_find_next_entry(&xps->xps_xprt_list, cur, true); +} + +static +struct rpc_xprt *xprt_switch_find_next_entry_offline(struct rpc_xprt_switch *xps, + const struct rpc_xprt *cur) +{ + return xprt_switch_find_next_entry(&xps->xps_xprt_list, cur, false); } static @@ -407,6 +466,13 @@ struct rpc_xprt *xprt_iter_next_entry_all(struct rpc_xprt_iter *xpi) xprt_switch_find_next_entry_all); } +static +struct rpc_xprt *xprt_iter_next_entry_offline(struct rpc_xprt_iter *xpi) +{ + return xprt_iter_next_entry_multiple(xpi, + xprt_switch_find_next_entry_offline); +} + /* * xprt_iter_rewind - Resets the xprt iterator * @xpi: pointer to rpc_xprt_iter @@ -460,6 +526,12 @@ void xprt_iter_init_listall(struct rpc_xprt_iter *xpi, __xprt_iter_init(xpi, xps, &rpc_xprt_iter_listall); } +void xprt_iter_init_listoffline(struct rpc_xprt_iter *xpi, + struct rpc_xprt_switch *xps) +{ + __xprt_iter_init(xpi, xps, &rpc_xprt_iter_listoffline); +} + /** * xprt_iter_xchg_switch - Atomically swap out the rpc_xprt_switch * @xpi: pointer to rpc_xprt_iter @@ -574,3 +646,10 @@ const struct rpc_xprt_iter_ops rpc_xprt_iter_listall = { .xpi_xprt = xprt_iter_current_entry, .xpi_next = xprt_iter_next_entry_all, }; + +static +const struct rpc_xprt_iter_ops rpc_xprt_iter_listoffline = { + .xpi_rewind = xprt_iter_default_rewind, + .xpi_xprt = xprt_iter_current_entry_offline, + .xpi_next = xprt_iter_next_entry_offline, +}; From patchwork Thu Jul 21 22:07:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F0C3CCA489 for ; Thu, 21 Jul 2022 22:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233630AbiGUWHY (ORCPT ); Thu, 21 Jul 2022 18:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiGUWHX (ORCPT ); Thu, 21 Jul 2022 18:07:23 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2973788744 for ; Thu, 21 Jul 2022 15:07:23 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id r70so2424995iod.10 for ; Thu, 21 Jul 2022 15:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vIyXLih17IFq9Hem/fPPzOaVUqi9lAXKUF6zPciEpd0=; b=b8aJtlsGTgDRcNnZJBYO2Pb+gfpxgRuwL6yqzSPRIqb7hyYECtWr0kAqgLHcThG4TI 48j5h89AsAk8jCmM+BUuXH1rQbVlNlPi0nB/7u4STL+CWEMQQfsxXFXsc1OkOq1ZDzIw GC5O2WmAI6KdS64xu6Aqs9Z8sEDrdoEL38DlPEcym/84EX92+6aDbIttK3w9TsvMkM9m hevU6tqF/7uoazlaecYzmn12yeK+cP6EapiPY84R0Y6XkYk8m0nWlCbq14MJvnaAdhuM vG0N4X7bXaRCj98qk2Bk232ohrIRqW9Q1W4ziB0Y9Ua/a4Ua04W50T+YcYVD7F3+Tr21 pUMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vIyXLih17IFq9Hem/fPPzOaVUqi9lAXKUF6zPciEpd0=; b=icGfx2PknKwXJay1UXtoCtMmWBGjvSnhG3GFC+funDv8ZP8XgRx3651TMQzF8m80MD /g+QShIqM6fHFlVvSbyMMz3KYFQBb1uteCyrmO8nZ2dkoXAM/wRLvd1ER3+EdPoXE98v FrkNk0gEqQj/gtNUj5haBx3+HXMSvK1f8M9DriMLb1DP4OpOv9xVp7xTWeuA8XsW5rdM /MPl5CadTdwsfia7h2XdbGWNd6CGu8fMX5MQXppKIipjIpsi92c7fzvOyRGBgYTSVnKh 5STmF5hr4RPXNDbVf1F/SeYiSyqTd/h5ZHO9mjD0eo0ZNo5SM4V4mZgc21TI9uYPo1XZ pFlQ== X-Gm-Message-State: AJIora9XPk/T+3NXvV+QZQAHVpwqbQYGQUW/GnQrPGP1OX+/4MRFSJdb 9t3mQ0j9AQt+I9dQtfMN+Kw= X-Google-Smtp-Source: AGRyM1v7LLPmvyF4KXid4q0s9By+Z5RkVqK7guI4PE7vIz/3UyPps8v5Yw5nmBv8wHV8M1xFiaEgGw== X-Received: by 2002:a6b:f910:0:b0:67c:4d66:3a88 with SMTP id j16-20020a6bf910000000b0067c4d663a88mr228950iog.49.1658441242572; Thu, 21 Jul 2022 15:07:22 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:22 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 05/11] SUNRPC enable back offline transports in trunking discovery Date: Thu, 21 Jul 2022 18:07:08 -0400 Message-Id: <20220721220714.22620-6-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia When we are adding a transport to a xprt_switch that's already on the list but has been marked OFFLINE, then make the state ONLINE since it's been tested now. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/clnt.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index d14333f4947a..71a3a1dd7e81 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -242,6 +242,7 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *); void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *); bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, const struct sockaddr *sap); +void rpc_clnt_xprt_set_online(struct rpc_clnt *clnt, struct rpc_xprt *xprt); void rpc_cleanup_clids(void); static inline int rpc_reply_expected(struct rpc_task *task) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index ada45b3b1dad..036ccf01bd25 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -3095,8 +3095,22 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) } EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_put); +void rpc_clnt_xprt_set_online(struct rpc_clnt *clnt, struct rpc_xprt *xprt) +{ + struct rpc_xprt_switch *xps; + + rcu_read_lock(); + xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); + rcu_read_unlock(); + xprt_set_online_locked(xprt, xps); +} + void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) { + if (rpc_clnt_xprt_switch_has_addr(clnt, + (const struct sockaddr *)&xprt->addr)) { + return rpc_clnt_xprt_set_online(clnt, xprt); + } rcu_read_lock(); rpc_xprt_switch_add_xprt(rcu_dereference(clnt->cl_xpi.xpi_xpswitch), xprt); From patchwork Thu Jul 21 22:07:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925808 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAB70C43334 for ; Thu, 21 Jul 2022 22:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233686AbiGUWHZ (ORCPT ); Thu, 21 Jul 2022 18:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiGUWHZ (ORCPT ); Thu, 21 Jul 2022 18:07:25 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D9C38875F for ; Thu, 21 Jul 2022 15:07:24 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id y13so1433081ilv.5 for ; Thu, 21 Jul 2022 15:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CQAt8edP4jBxj/fXQ78ofDRK5ysG6X+fFnsG4SDF2y4=; b=ewqNfflJv2boZm6KB3Yisj5d6afivKWk99QjKvGsx60+XB1IGQCGQ6OOT+ijDeg0B7 zVrd8dhKfzIxgUFotOXTP5gQ/QU62DSg6SMql7Pm1VJCoKTERmON7eADIHzOH8+D7O5w Lz8zliTsDjHyMhgtt1JV6isaeWpHRyIjKl8pu3Gl3qIyzjZzgY1l/ulNvvee/m0oeZEw yIc9+tqsRNLinTV36LW/Ngn7qedZz619PhF918aRQU7hdnRknvi16tLGnHIjNDh2sO6H nJiFJ789bazBftUc2UmZW6PZVYNS4A4CgIFBK2sr/2IT9DxDeVJpEAanhlgI1srxuHNg dSjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CQAt8edP4jBxj/fXQ78ofDRK5ysG6X+fFnsG4SDF2y4=; b=PSLQFArCFoyMqBCJlPRA1kIe0hNaUaZK8HCX3/Em+VvVuiRt9/qx3vDSUFpnRmRsYf T2sYjIb7z8R3WHl90kbsSl/GltlxHkGcz9+2aUm2Ta53gTpke98fNH7lLE5i+USk5TSb LN5xhsFKKCD32fOLiS/r6BWoQKAhaRM4fQJlVP2ip2koGGFOQk1JShHDjhspNoXEkuJ3 jGsSr8XTE34t+gx4SCkfzZ7ey8HCUl+eu/cmOZaeyUJaHiHbk2rjQdkI48seNyOEwwms UbX9/kWbzwhHFC5iAKtQa8tCT/rb90GO+cbrqkNWB8s1wf8y3pjJK+9/zIMnLN2NmMpm Kfdw== X-Gm-Message-State: AJIora9bwq3bTy1Dg/aIQqkViNn99LlZCJDH+2l+r6oNCJLAlrHR0BU5 JS2870UWWLLNvsKfh9d0gwI= X-Google-Smtp-Source: AGRyM1tve6ZphCANS4ie1iMufaZMOcLa48DBbd+PjdEF0NBXODy2l/b9qowxI0zHHKJeMvNus+fTNg== X-Received: by 2002:a05:6e02:1906:b0:2dc:731b:561 with SMTP id w6-20020a056e02190600b002dc731b0561mr207343ilu.284.1658441243667; Thu, 21 Jul 2022 15:07:23 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:23 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 06/11] SUNRPC create an rpc function that allows xprt removal from rpc_clnt Date: Thu, 21 Jul 2022 18:07:09 -0400 Message-Id: <20220721220714.22620-7-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Expose a function that allows a removal of xprt from the rpc_clnt. When called from NFS that's running a trunked transport then don't decrement the active transport counter. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprtmultipath.h | 2 +- net/sunrpc/clnt.c | 16 +++++++++++++++- net/sunrpc/xprt.c | 2 +- net/sunrpc/xprtmultipath.c | 10 +++++----- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 71a3a1dd7e81..7a43fd514398 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -240,6 +240,7 @@ const char *rpc_proc_name(const struct rpc_task *task); void rpc_clnt_xprt_switch_put(struct rpc_clnt *); void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *); +void rpc_clnt_xprt_switch_remove_xprt(struct rpc_clnt *, struct rpc_xprt *); bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, const struct sockaddr *sap); void rpc_clnt_xprt_set_online(struct rpc_clnt *clnt, struct rpc_xprt *xprt); diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h index 688ca7eb1d01..9fff0768d942 100644 --- a/include/linux/sunrpc/xprtmultipath.h +++ b/include/linux/sunrpc/xprtmultipath.h @@ -55,7 +55,7 @@ extern void rpc_xprt_switch_set_roundrobin(struct rpc_xprt_switch *xps); extern void rpc_xprt_switch_add_xprt(struct rpc_xprt_switch *xps, struct rpc_xprt *xprt); extern void rpc_xprt_switch_remove_xprt(struct rpc_xprt_switch *xps, - struct rpc_xprt *xprt); + struct rpc_xprt *xprt, bool offline); extern void xprt_iter_init(struct rpc_xprt_iter *xpi, struct rpc_xprt_switch *xps); diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 036ccf01bd25..82a829798d96 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2144,7 +2144,8 @@ call_connect_status(struct rpc_task *task) xprt_release(task); value = atomic_long_dec_return(&xprt->queuelen); if (value == 0) - rpc_xprt_switch_remove_xprt(xps, saved); + rpc_xprt_switch_remove_xprt(xps, saved, + true); xprt_put(saved); task->tk_xprt = NULL; task->tk_action = call_start; @@ -3118,6 +3119,19 @@ void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) } EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_add_xprt); +void rpc_clnt_xprt_switch_remove_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) +{ + struct rpc_xprt_switch *xps; + + rcu_read_lock(); + xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); + rpc_xprt_switch_remove_xprt(rcu_dereference(clnt->cl_xpi.xpi_xpswitch), + xprt, 0); + xps->xps_nunique_destaddr_xprts--; + rcu_read_unlock(); +} +EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_remove_xprt); + bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, const struct sockaddr *sap) { diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 8f8e3c952f24..44348c9f4b00 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -2182,5 +2182,5 @@ void xprt_delete_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps) if (!xprt->sending.qlen && !xprt->pending.qlen && !xprt->backlog.qlen && !atomic_long_read(&xprt->queuelen)) - rpc_xprt_switch_remove_xprt(xps, xprt); + rpc_xprt_switch_remove_xprt(xps, xprt, true); } diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 8def8423fc0a..39a8a2f9c982 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -62,11 +62,11 @@ void rpc_xprt_switch_add_xprt(struct rpc_xprt_switch *xps, } static void xprt_switch_remove_xprt_locked(struct rpc_xprt_switch *xps, - struct rpc_xprt *xprt) + struct rpc_xprt *xprt, bool offline) { if (unlikely(xprt == NULL)) return; - if (!test_bit(XPRT_OFFLINE, &xprt->state)) + if (!test_bit(XPRT_OFFLINE, &xprt->state) && offline) xps->xps_nactive--; xps->xps_nxprts--; if (xps->xps_nxprts == 0) @@ -83,10 +83,10 @@ static void xprt_switch_remove_xprt_locked(struct rpc_xprt_switch *xps, * Removes xprt from the list of struct rpc_xprt in xps. */ void rpc_xprt_switch_remove_xprt(struct rpc_xprt_switch *xps, - struct rpc_xprt *xprt) + struct rpc_xprt *xprt, bool offline) { spin_lock(&xps->xps_lock); - xprt_switch_remove_xprt_locked(xps, xprt); + xprt_switch_remove_xprt_locked(xps, xprt, offline); spin_unlock(&xps->xps_lock); xprt_put(xprt); } @@ -155,7 +155,7 @@ static void xprt_switch_free_entries(struct rpc_xprt_switch *xps) xprt = list_first_entry(&xps->xps_xprt_list, struct rpc_xprt, xprt_switch); - xprt_switch_remove_xprt_locked(xps, xprt); + xprt_switch_remove_xprt_locked(xps, xprt, true); spin_unlock(&xps->xps_lock); xprt_put(xprt); spin_lock(&xps->xps_lock); From patchwork Thu Jul 21 22:07:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3FACC433EF for ; Thu, 21 Jul 2022 22:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232613AbiGUWH0 (ORCPT ); Thu, 21 Jul 2022 18:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233567AbiGUWHZ (ORCPT ); Thu, 21 Jul 2022 18:07:25 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C22593C2B for ; Thu, 21 Jul 2022 15:07:25 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id q14so2445078iod.3 for ; Thu, 21 Jul 2022 15:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DoUJZLq0Q8GZjOnn3UNt3Y1wfADTVPUmy+JhoS9xaBU=; b=aYK21nDr9DrJJQSjoTdtVSgSSU0KuOkHOkdiYQkJI7TcieG7HQO0u15TO00WsitvLT +ZjQ2GKJ0Ytzr1Tq3qytLf0acJMC+7BO+wy/t/R74ZzjjNoC1deLeL06lc1WRHKYoTPn 2lWdp/nlmLICMNqf2i4JNoyQKGcUaDAbzugjG7RnrNkPUT7iZXx6CRlXqNVUNTWze/xj ecK//yTEGZknXxR0vXCcv+lIXou0+AfG/5TxdDpr5C/zxkp4eEdY1kSBs3iZtr//ZJ19 2JVbxJ6u04uXvhREMRiTD5SB2SrDWlAxELQ+s7TkxJd8bYHasPxlnRCId9Vi3JvlWey8 AiVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DoUJZLq0Q8GZjOnn3UNt3Y1wfADTVPUmy+JhoS9xaBU=; b=uvh+naNSn06kY67gri2GNhWcAz/UD9mx9XfnVrgeJzGGOpyqj1inuflTxKK0++to6B RADEhCcnddITqZO/zgu3P436zJnYT4POoF6wWGUccFhopu7483W5uOFlWU1Zqp4lJ/Rg +W8J9RMw6rdb/VxI+qM7SP0TbJpocrI9+/vpu5RhuUAvXPuJIitDEzT+9RR5/Kq0XmTy PEkZKv3zFlxdRitwn4Ore609j6yskrQk3qvA2RaK/oOmjZvkocbykAr7eF3nwPxC76EY D8Ni53YOF+ckoZ6fUZaJnE3XpYF9UfBs8C+kedr6NLOsdlhFqHN9a86vjOMIrJNQ3u0W RGBQ== X-Gm-Message-State: AJIora+JY2o6JzqcELktzt+R35BoQUK16UyDwUj+55OUKk5v6xdcW9Gs lD1pRon2WfFuB2MHrV9a5jVuUb+C+DA= X-Google-Smtp-Source: AGRyM1sD058g+WX689hjyh8xaalP0X12LyHPXhlDr+RIEUAQ5mxOlD7AbkhRxt0D/4aQPfx03s7r+g== X-Received: by 2002:a05:6638:22d5:b0:33f:8cee:b55f with SMTP id j21-20020a05663822d500b0033f8ceeb55fmr287994jat.134.1658441244751; Thu, 21 Jul 2022 15:07:24 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:24 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 07/11] NFSv4.1 remove xprt from xprt_switch if session trunking test fails Date: Thu, 21 Jul 2022 18:07:10 -0400 Message-Id: <20220721220714.22620-8-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we are doing a session trunking test and it fails for the transport, then remove this transport from the xprt_switch group. Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 9ae7d792beee..b805541f4501 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -8924,6 +8924,9 @@ void nfs4_test_session_trunk(struct rpc_clnt *clnt, struct rpc_xprt *xprt, if (status == 0) rpc_clnt_xprt_switch_add_xprt(clnt, xprt); + else if (rpc_clnt_xprt_switch_has_addr(clnt, + (struct sockaddr *)&xprt->addr)) + rpc_clnt_xprt_switch_remove_xprt(clnt, xprt); rpc_put_task(task); } From patchwork Thu Jul 21 22:07:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0AEBC433EF for ; Thu, 21 Jul 2022 22:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233846AbiGUWH2 (ORCPT ); Thu, 21 Jul 2022 18:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233721AbiGUWH1 (ORCPT ); Thu, 21 Jul 2022 18:07:27 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7196293C25 for ; Thu, 21 Jul 2022 15:07:26 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id 125so2433485iou.6 for ; Thu, 21 Jul 2022 15:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pSEshAwV3+BcDMr8M3DYQ/arl+CSUkr59U4M5IHghNU=; b=h5xLaWgUJAUeqOue6mbiGcqKgetp6P/L1mJm4x40rfHTDSeIvRE6rzw8GOj+hNr6UG uzTVhZktYktUb0m/cOHr8PX+QCwDpP+7RNRXMnT+gOkkrlm0WR74fDvcUgdO2oTggTWy w8Dcp8t+/ENr+qv+jgJawy4yLFykYpGGdlVnSFUUSJtTPvbH4yNpv99a7bVDSyX9xsoP Rpn2vInZg2lnMxjizG9mXvs0d1JY5NmfzgUIe/4rS3fDeCgg48E9PbgP5ep3+Gn2M/Ar GGs0SxdmnbgvZXMFmVJ5+QKaDSedpL84ap5BLV1Wf7T+q1cXo86wMX/WAu6cTcX/we32 ByGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pSEshAwV3+BcDMr8M3DYQ/arl+CSUkr59U4M5IHghNU=; b=YMYrk9nQtGUBsFmFnWOMeFsJ84idISgePuzBfwJHYQFCIuGjL7oeM9M+QZD8xgsWjM +JWwd8RMrcDfQwG4IAx9oj+ls9O+/xmXOVDhRN+vdvmhg4W8jmeF6zWBuxUauCJoFheI CrY70fgUuV6HH2WUURtLtrUxdDchnAm3Pb7LaftPqWcocXyDau/5SrSQVwfbyi/9v9tV /+WH/Yctox/z7jGm2IL65T88h+s1Awg8Mt5W4quXfjD210iIG0ySoMIV4uJFg1dYIbS3 /dhskKV8RYPL1zX6J8gQAVHe0jScTSW5Cq6b8qIKHso6miIte1sfUBjfVvgAItiiSedy EyYQ== X-Gm-Message-State: AJIora+pItoysyl61fEA6XQm6X6Kj4gQ+d373GvwlJKrNWwYSz6I5hwO As9yiAPYSceDtHFtOBRKU/ef+tMAkYo= X-Google-Smtp-Source: AGRyM1uYalwvI40y0Nx78USfAOZQ7jMCMj3VgXabJv5iQPRgoI99puxhT1ZGulqXP0EPMjSpB97k7w== X-Received: by 2002:a05:6638:348c:b0:33f:82b2:7441 with SMTP id t12-20020a056638348c00b0033f82b27441mr301734jal.296.1658441245795; Thu, 21 Jul 2022 15:07:25 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:25 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 08/11] SUNRPC restructure rpc_clnt_setup_test_and_add_xprt Date: Thu, 21 Jul 2022 18:07:11 -0400 Message-Id: <20220721220714.22620-9-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org In preparation for code re-use, pull out the part of the rpc_clnt_setup_test_and_add_xprt() portion that sends a NULL rpc and then calls a session trunking function into a helper function. Re-organize the end of the function for code re-use. Signed-off-by: Olga Kornievskaia --- net/sunrpc/clnt.c | 52 ++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 82a829798d96..c226025dbe97 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2874,6 +2874,30 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, } EXPORT_SYMBOL_GPL(rpc_clnt_test_and_add_xprt); +static int rpc_clnt_add_xprt_helper(struct rpc_clnt *clnt, + struct rpc_xprt *xprt, + struct rpc_add_xprt_test *data) +{ + struct rpc_task *task; + int status = -EADDRINUSE; + + /* Test the connection */ + task = rpc_call_null_helper(clnt, xprt, NULL, 0, NULL, NULL); + if (IS_ERR(task)) + return PTR_ERR(task); + + status = task->tk_status; + rpc_put_task(task); + + if (status < 0) + return status; + + /* rpc_xprt_switch and rpc_xprt are deferrenced by add_xprt_test() */ + data->add_xprt_test(clnt, xprt, data->data); + + return 0; +} + /** * rpc_clnt_setup_test_and_add_xprt() * @@ -2897,8 +2921,6 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *data) { - struct rpc_task *task; - struct rpc_add_xprt_test *xtest = (struct rpc_add_xprt_test *)data; int status = -EADDRINUSE; xprt = xprt_get(xprt); @@ -2907,31 +2929,19 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt, if (rpc_xprt_switch_has_addr(xps, (struct sockaddr *)&xprt->addr)) goto out_err; - /* Test the connection */ - task = rpc_call_null_helper(clnt, xprt, NULL, 0, NULL, NULL); - if (IS_ERR(task)) { - status = PTR_ERR(task); - goto out_err; - } - status = task->tk_status; - rpc_put_task(task); - + status = rpc_clnt_add_xprt_helper(clnt, xprt, data); if (status < 0) goto out_err; - /* rpc_xprt_switch and rpc_xprt are deferrenced by add_xprt_test() */ - xtest->add_xprt_test(clnt, xprt, xtest->data); - - xprt_put(xprt); - xprt_switch_put(xps); - - /* so that rpc_clnt_add_xprt does not call rpc_xprt_switch_add_xprt */ - return 1; + status = 1; out_err: xprt_put(xprt); xprt_switch_put(xps); - pr_info("RPC: rpc_clnt_test_xprt failed: %d addr %s not added\n", - status, xprt->address_strings[RPC_DISPLAY_ADDR]); + if (status < 0) + pr_info("RPC: rpc_clnt_test_xprt failed: %d addr %s not " + "added\n", status, + xprt->address_strings[RPC_DISPLAY_ADDR]); + /* so that rpc_clnt_add_xprt does not call rpc_xprt_switch_add_xprt */ return status; } EXPORT_SYMBOL_GPL(rpc_clnt_setup_test_and_add_xprt); From patchwork Thu Jul 21 22:07:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 877F6C433EF for ; Thu, 21 Jul 2022 22:07:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234059AbiGUWHa (ORCPT ); Thu, 21 Jul 2022 18:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233567AbiGUWH2 (ORCPT ); Thu, 21 Jul 2022 18:07:28 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6658C88744 for ; Thu, 21 Jul 2022 15:07:27 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id n13so1529574ilk.1 for ; Thu, 21 Jul 2022 15:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kzKDy/oo4K872vTHa81TxBHb9FldfgxoqNd8x+GKTI4=; b=moggTBNZcWBvpwHRjT5KolGGTNVPOE3z5BsWxKYLw7+VIL3v+HES87qP+c8PY+HMz4 r4O/ybup5gahRfDp2lushqzqxriQa2rkOO7HZx/hZ4pf5HX0T4gC5t9fc9N9uYesWlVE IuxuSbCw8h25k9M9pKO9lYZX2XhK1CqonKO0zb5QfKr40B4X9llo3hS67iEX90AJ/7kI GDnCuys5UrJnJQ1npeWv7i1hD0Zf9DmN7Ll8sE2bmC6/6RI85LxS4VP9YlztrnYbsj57 ymY1FGryT/jM5oPpBo5nfOzQ0mr2y7tIoa0ApbTE824Trr5PV5plEfWWxeDGSc5GxAnS bIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kzKDy/oo4K872vTHa81TxBHb9FldfgxoqNd8x+GKTI4=; b=XiUOFGCE3dfP2Tot4AZnq8vEIdcPE/DzWCQ4M4VvYhPjBILON/9YCIVGwg98PCmqA0 M0dCuq5IlsYZRlhMC9DAMdPQ8r30aZH7/obZwWboq3m6uTfjgcjbGpXLSfDP0RGhsWFo 9IBzCuHchCOT1GrAx/cqDyBTsEdvBPYip2NhkYBXIo6Mgaqss27fTHlfqDMdPYrgP1/z QSVOgGwuAvOCvsO3DCjOI3swusjgYhPV8SPPnafVUGeTW7taiRcEBczE6ZE+/DPFV8ux mwLPjX9TgK0EuYzP7obOgiwNFSDIUM8brp41CtK/iXonH1mMBtJzFUneRgaD4QWmuVZz m5pg== X-Gm-Message-State: AJIora8eEqzCm+0cG5a9oIX7dHOswc6siV1kITMzawooK3sA13ca73Pc Ru8ilMxwyGK8plgz7kyTSd/BIuSDqa0= X-Google-Smtp-Source: AGRyM1vVVyJx47HPNsgRr4PJDssGu/Dt2bL8i1XimME6XlwEKTPtbh9j1jWcVCfIjfcvEQqx6gi4eg== X-Received: by 2002:a05:6e02:1b0b:b0:2dc:ffce:db4 with SMTP id i11-20020a056e021b0b00b002dcffce0db4mr228691ilv.184.1658441246844; Thu, 21 Jul 2022 15:07:26 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:26 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 09/11] SUNRPC export xprt_iter_rewind function Date: Thu, 21 Jul 2022 18:07:12 -0400 Message-Id: <20220721220714.22620-10-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Make xprt_iter_rewind callable outside of xprtmultipath.c Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/xprtmultipath.h | 2 ++ net/sunrpc/xprtmultipath.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h index 9fff0768d942..c0514c684b2c 100644 --- a/include/linux/sunrpc/xprtmultipath.h +++ b/include/linux/sunrpc/xprtmultipath.h @@ -68,6 +68,8 @@ extern void xprt_iter_init_listoffline(struct rpc_xprt_iter *xpi, extern void xprt_iter_destroy(struct rpc_xprt_iter *xpi); +extern void xprt_iter_rewind(struct rpc_xprt_iter *xpi); + extern struct rpc_xprt_switch *xprt_iter_xchg_switch( struct rpc_xprt_iter *xpi, struct rpc_xprt_switch *newswitch); diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 39a8a2f9c982..e77f8ad50b6f 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -480,7 +480,6 @@ struct rpc_xprt *xprt_iter_next_entry_offline(struct rpc_xprt_iter *xpi) * Resets xpi to ensure that it points to the first entry in the list * of transports. */ -static void xprt_iter_rewind(struct rpc_xprt_iter *xpi) { rcu_read_lock(); From patchwork Thu Jul 21 22:07:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2612DC43334 for ; Thu, 21 Jul 2022 22:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbiGUWHb (ORCPT ); Thu, 21 Jul 2022 18:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbiGUWH3 (ORCPT ); Thu, 21 Jul 2022 18:07:29 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8383993C25 for ; Thu, 21 Jul 2022 15:07:28 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id n7so2433742ioo.7 for ; Thu, 21 Jul 2022 15:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NLZyY+3mcqNnIhGziWEpPlQT8AF5MejXmXGzyCqVaII=; b=gfWUuTDFAd+JZdKsBKj2Aavr7m7Jw34AQRAbKngM6/JO9vuze+zSfvCIQYKzTgKzvN u3VCjpuk2jAfv5CiyhtYuCHsyMaqqs0s0q8X9M5255kcjiUFjaXBBWfhDx1ZWIqXR5Sj CrCUKXDR3Z7wivl7FRwhok9LPKoZSx7mpfGSiblI+PpW37SFCYQ9pEJC5Jo5ur1TJHq5 o82c/jLgYyWIxCKNNgBlRabramyNj87dZv65M3brl4VBFCazPfSMZYs6gbDxD7FYPaPx WUZgU5J1o7i9uT3jerVU7RLPbQWtgNANZd798QkwXrRLNbXWgIUAt45M/TL9Wntztbf6 NMjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NLZyY+3mcqNnIhGziWEpPlQT8AF5MejXmXGzyCqVaII=; b=Fk1vBEKZPWeOXjbcxp7S953Q4/WJZ711yijWHwNF/7vZBwNQvurVxhqp1HEI5NxO9h wSB3TCAhUPvgZAKMhBbyu70fgZHEge/RYKgPRKZ9phoaO7kY8NeJ74ieBZnK8wAp5IOv lm8jy8Ba3cJtkhRo5POy2YMjkmW+Gvs0STD4+QD7db0AwPlkWhPl8I10XZJPn1aRLO72 55x6GDixOHE1l8esNA4FqRujt4/Ppx1h2YRkBeVhyawabdH+i/PXJvj+fwunf5iuYOIH 5LWekJp2pmYZhzQKPkXBr+tvw1z2d51Dlf/BGqmc9zBnvQo5b/QZ4+4JRVhP+FFUWxBf tTVw== X-Gm-Message-State: AJIora+q3xOsiPjyw0U4WfipyPJM1No6Z+PyhHdulBu5pfbyduQqBIfF /FIA+C/fXvaiwNtcICzsqDSIlxZNY1s= X-Google-Smtp-Source: AGRyM1uljsw/BU13IqUapJpljymz+L2DZG/PV9q8IscL8lJN2Kr0OAhd3kiwTZgA/sB8Lg3yRSGO0A== X-Received: by 2002:a05:6638:210b:b0:33f:5635:4c4b with SMTP id n11-20020a056638210b00b0033f56354c4bmr330051jaj.116.1658441247885; Thu, 21 Jul 2022 15:07:27 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:27 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 10/11] SUNRPC create a function that probes only offline transports Date: Thu, 21 Jul 2022 18:07:13 -0400 Message-Id: <20220721220714.22620-11-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org For only offline transports, attempt to check connectivity via a NULL call and, if that succeeds, call a provided session trunking detection function. Signed-off-by: Olga Kornievskaia --- include/linux/sunrpc/clnt.h | 2 ++ net/sunrpc/clnt.c | 65 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 7a43fd514398..75eea5ebb179 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -235,6 +235,8 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *, struct rpc_xprt *, void *); void rpc_clnt_manage_trunked_xprts(struct rpc_clnt *); +void rpc_clnt_probe_trunked_xprts(struct rpc_clnt *, + struct rpc_add_xprt_test *); const char *rpc_proc_name(const struct rpc_task *task); diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index c226025dbe97..0c24a97ecba0 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -807,6 +807,13 @@ int rpc_clnt_xprt_iter_init(struct rpc_clnt *clnt, struct rpc_xprt_iter *xpi) return _rpc_clnt_xprt_iter_init(clnt, xpi, xprt_iter_init_listall); } +static +int rpc_clnt_xprt_iter_offline_init(struct rpc_clnt *clnt, + struct rpc_xprt_iter *xpi) +{ + return _rpc_clnt_xprt_iter_init(clnt, xpi, xprt_iter_init_listoffline); +} + /** * rpc_clnt_iterate_for_each_xprt - Apply a function to all transports * @clnt: pointer to client @@ -3018,6 +3025,64 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, } EXPORT_SYMBOL_GPL(rpc_clnt_add_xprt); +static int rpc_xprt_probe_trunked(struct rpc_clnt *clnt, + struct rpc_xprt *xprt, + struct rpc_add_xprt_test *data) +{ + struct rpc_xprt_switch *xps; + struct rpc_xprt *main_xprt; + int status = 0; + + xprt_get(xprt); + + rcu_read_lock(); + main_xprt = xprt_get(rcu_dereference(clnt->cl_xprt)); + xps = xprt_switch_get(rcu_dereference(clnt->cl_xpi.xpi_xpswitch)); + status = rpc_cmp_addr_port((struct sockaddr *)&xprt->addr, + (struct sockaddr *)&main_xprt->addr); + rcu_read_unlock(); + xprt_put(main_xprt); + if (status || !test_bit(XPRT_OFFLINE, &xprt->state)) + goto out; + + status = rpc_clnt_add_xprt_helper(clnt, xprt, data); +out: + xprt_put(xprt); + xprt_switch_put(xps); + return status; +} + +/* rpc_clnt_probe_trunked_xprt -- probe offlined transport for session trunking + * @clnt rpc_clnt structure + * + * For each offlined transport found in the rpc_clnt structure call + * the function rpc_xprt_probe_trunked() which will determine if this + * transport still belongs to the trunking group. + */ +void rpc_clnt_probe_trunked_xprts(struct rpc_clnt *clnt, + struct rpc_add_xprt_test *data) +{ + struct rpc_xprt_iter xpi; + int ret; + + ret = rpc_clnt_xprt_iter_offline_init(clnt, &xpi); + if (ret) + return; + for (;;) { + struct rpc_xprt *xprt = xprt_iter_get_next(&xpi); + + if (!xprt) + break; + ret = rpc_xprt_probe_trunked(clnt, xprt, data); + xprt_put(xprt); + if (ret < 0) + break; + xprt_iter_rewind(&xpi); + } + xprt_iter_destroy(&xpi); +} +EXPORT_SYMBOL_GPL(rpc_clnt_probe_trunked_xprts); + static int rpc_xprt_offline(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *data) From patchwork Thu Jul 21 22:07:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12925813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F153CCA489 for ; Thu, 21 Jul 2022 22:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233721AbiGUWHd (ORCPT ); Thu, 21 Jul 2022 18:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234000AbiGUWHa (ORCPT ); Thu, 21 Jul 2022 18:07:30 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEACB93C2B for ; Thu, 21 Jul 2022 15:07:29 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id u20so2429630iob.8 for ; Thu, 21 Jul 2022 15:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mcqOOLA/HQO8uLApukS1MK6XhSilmUS6rT32N7eaYwk=; b=em8U93eOtslfCHwL4uxUDCysT0SteoyYDges/EbYygTipY0mvXFgIghZjjuP7et+5/ O6XP0kKkcTc6tyOOrFoo3JAuPnfoRozrnQQiZ6KADvmQWdEh3daEHU26OgXXUKSJmX9S JHAwMFq+6G+9e+EAXReDu32oYATlkPFZjx6XFkt7xbAAy1WFsMPfLXSgGHWCK2jyziCg jhj9qgKSj749JeO3RB1eOMCnsuVG/Lrww+6zrjYv7NLlWn5IobvbX/EgpV4UJ15iNI7+ KVrHRoOwogcIznaNG0QutY0u6EJW+U18mfGrnpauzWnQNTnbmlOPZkv/Niy67bFODzca mWYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mcqOOLA/HQO8uLApukS1MK6XhSilmUS6rT32N7eaYwk=; b=UwKNUKlL4w46o2dBZrzMQL57tMwB3nQijXMq+mvm+lwy0r7SBncdMgJnF4VlW0fGq5 2dBjADCb6jKX/SjRZZBuOy+rWdRGbkaXQUyz1Al7qCLXzSVnirBzA1Cum/x3f+ykm4nA 8++aKQGFo9OLS1yuRVHOcrQX9PYj705kYnFtdzImJ0ZLCAUIAiprS5hn1jBiSvzdvXxI fvB2pw98gehwpZzmCG4JXJL+Yv61CL3P1OS/neBCaoDFKdvP56sIWLr55jauTCDrmDh/ wsc6wlQnx4GCZcTren/6ZztO4laW2LZbpeznYzXMWu+BXd3ozAPRd9k6soI3mhhwEF5x BAlw== X-Gm-Message-State: AJIora+qY+nlaC4vwY+qJ+yuYD2htoHXFgshinH5l5zbrzNx4JJS0GS6 hSNTRCzY0VFd1IAaHWba8h0NNPam88c= X-Google-Smtp-Source: AGRyM1tvFcV+K/UIMAOejDV1dmtrebzyZNzEUsvl2MzZtsafi9VNszGd0LAeiAP33fgm3PnH7g4USQ== X-Received: by 2002:a05:6638:304a:b0:335:ba01:8be9 with SMTP id u10-20020a056638304a00b00335ba018be9mr282005jak.273.1658441249074; Thu, 21 Jul 2022 15:07:29 -0700 (PDT) Received: from kolga-mac-1.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id g11-20020a05663811cb00b00341668383cfsm1281105jas.33.2022.07.21.15.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 15:07:28 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 11/11] NFSv4.1 probe offline transports for trunking on session creation Date: Thu, 21 Jul 2022 18:07:14 -0400 Message-Id: <20220721220714.22620-12-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220721220714.22620-1-olga.kornievskaia@gmail.com> References: <20220721220714.22620-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Once the session is established call into the SUNRPC layer to check if any offlined trunking connections should be re-enabled. Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4proc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b805541f4501..c5f17af9370f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9251,6 +9251,13 @@ int nfs4_proc_create_session(struct nfs_client *clp, const struct cred *cred) int status; unsigned *ptr; struct nfs4_session *session = clp->cl_session; + struct nfs4_add_xprt_data xprtdata = { + .clp = clp, + }; + struct rpc_add_xprt_test rpcdata = { + .add_xprt_test = clp->cl_mvops->session_trunk, + .data = &xprtdata, + }; dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); @@ -9267,6 +9274,7 @@ int nfs4_proc_create_session(struct nfs_client *clp, const struct cred *cred) ptr = (unsigned *)&session->sess_id.data[0]; dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); + rpc_clnt_probe_trunked_xprts(clp->cl_rpcclient, &rpcdata); out: return status; }