From patchwork Mon Jul 25 13:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928060 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 B9676CCA473 for ; Mon, 25 Jul 2022 13:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234647AbiGYNcj (ORCPT ); Mon, 25 Jul 2022 09:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234680AbiGYNci (ORCPT ); Mon, 25 Jul 2022 09:32:38 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73E312AB0 for ; Mon, 25 Jul 2022 06:32:35 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id 125so10665397vsd.5 for ; Mon, 25 Jul 2022 06:32:35 -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=BCNSC1WOn+Tj3xbCumjUim4k+wf2JFSxWUSscbxjBqCEKIcY5sLKlun8BFJR9MKMR3 BfyV3umNRihC7mjTDhffUMRmrx3lIU4jQOLW+Nx2PoPbiIljpcje3olsguvQumCQl1eO M48eQulrakP2pxeUTuGDOWX1LNu0fiICLShxURoHQbJlTu79+RQ35yoVhlXA5adrpIgT g2MV5/vD7UkjDd1ZHySc7lwLignV4e26+Ey7R/sPB7bLxir/P4DeMpaT5WdbDPJN3/CG hP6lyXy12x3s0Qwb4JjpHeuvi0738LwOI1XZEkoRpYdC6wW4gZ8CbNarmjF/o3OHLIJ/ 6xew== 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=sx0gjT26qm33P70KgdPFdQCakrUdhuvj/2oufliw30pMdOK6wH8RGUFZ/a8z5HGIbK u0TK2jKjnecG/bSQNJ6ORBIlgSw5XrdVCgvXnDz6DtW7rG4FAUR00eZSYI0JCx0HDaeH Evr7M0H3THftktdlwPxr4o6LOQa4PrBiz+w76QToyiK6/OaIXz7X9VbCVY6kkx976rlM 2i9FSMETpbeM7SsxMwtpZOzBSbuSrNPLf/ApRD13mvDUt96T8laP3nEnp4duXN7CvzY6 l8BimaOrnbZB3jmAbJ095Soxlxc9ahzJKO66FRIb8bM5hcxdUQA65+WMQjvZu5xRsO8P TbCw== X-Gm-Message-State: AJIora+5gg6CT2YDAKEBhGyIL4aWcrYTMdEZCd1p3E5jHy27361doEfa 6C3cZd1ODfV2HcxQ+DHe6+g= X-Google-Smtp-Source: AGRyM1vW5Zz4SHbpxzeLD/bNptjPvCute3FA0kYjzEu4qsukGTgwskVIGVnvKuxE66tX8FVLO2bt3g== X-Received: by 2002:a05:6102:3d29:b0:357:64aa:811f with SMTP id i41-20020a0561023d2900b0035764aa811fmr3197181vsv.58.1658755954915; Mon, 25 Jul 2022 06:32:34 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:34 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 01/11] SUNRPC expose functions for offline remote xprt functionality Date: Mon, 25 Jul 2022 09:32:21 -0400 Message-Id: <20220725133231.4279-2-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 Mon Jul 25 13:32:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928061 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 32CE2CCA48B for ; Mon, 25 Jul 2022 13:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232320AbiGYNcm (ORCPT ); Mon, 25 Jul 2022 09:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235329AbiGYNck (ORCPT ); Mon, 25 Jul 2022 09:32:40 -0400 Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3202013D5F for ; Mon, 25 Jul 2022 06:32:37 -0700 (PDT) Received: by mail-vs1-xe29.google.com with SMTP id k129so10681709vsk.2 for ; Mon, 25 Jul 2022 06:32:37 -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=5wosDX36v6gglpAi11Xe3KOeYvm5RG0CwIq9BrzDs9c=; b=POY6sGdOCq//qk3hTbKS+0PxBGOvjnXvdjDYYU+MS0N34//6Y1b7zkBAipqBgqAcql Mc9qDKBba1WQ/X+51CWmYjUx7JqKj+ONkISXw01E7xBOtUgZ6BXiyxV0uesr6Co5mtRf UCIYlBtYV1/IUORPumwK2mKydavgb/+wmCaOVW9avViWSw5t/4OW0qjE6kTVZ31tifFm 1oTysnxgdkEQiOyjyRyUF07jmUC1jhq0x/6J1RIAvIawkQtouBKlG0/8qGpXekv6rWLz RXCM0z6p2kYTl5Jmo2RDw/id6B9DNOW5o7NrkGRtgx5UJBQtpQ8eXiGCIylwe75Ghutf I78w== 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=5wosDX36v6gglpAi11Xe3KOeYvm5RG0CwIq9BrzDs9c=; b=Bc0k3w0/tCogEVQKeO8IVFxkNugiekp8SKz74oT1U/ft/qX/X/f6nptdwvr/gihJuk CGE1devWGZm1ojr2ZB6ZyhPovO1Bm8JT9kN5/Pzm439OfCG4Wy9Sn30ryRMr/GAU5srS xkRKNHhJXpM0rbb05RsuRHQxzP3ZMJCmA9rRH81iGfKxQBwf7kZ1UnXnoTaFDrLxv1Hq odSE+b4+77lxK8IuwTQMVNeIQ/gAv3SiVDj451B9svesm0eDWvWZIgN3aTJdlOyXwFjr YI6b0+6jb4sVJWQfrwlTSK5hZ+37BH5pSiHfU2iagJLQqqgOM6wnJbEVeo4thEsLBzi0 Of5w== X-Gm-Message-State: AJIora+tsTtzipbqYLxxUzwqFt7ToK87AA8edpLzXln1ZrYCFzmOK7CH MDdavRDVnA9vysExk4dUZ4zc6PSwhys= X-Google-Smtp-Source: AGRyM1tE8cLJ3bOroBPaQiK1cntJeWMEqPITHSHqxrS6PYhHJH+gnx5dYqqpACfurSQFh7s328JWGw== X-Received: by 2002:a67:b008:0:b0:357:93a5:f0e0 with SMTP id z8-20020a67b008000000b0035793a5f0e0mr3511170vse.34.1658755956114; Mon, 25 Jul 2022 06:32:36 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:35 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 02/11] SUNRPC add function to offline remove trunkable transports Date: Mon, 25 Jul 2022 09:32:22 -0400 Message-Id: <20220725133231.4279-3-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 a97d4e06cae3..2b079c4d8af1 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 Mon Jul 25 13:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928062 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 DD0D8C433EF for ; Mon, 25 Jul 2022 13:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235381AbiGYNcm (ORCPT ); Mon, 25 Jul 2022 09:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiGYNck (ORCPT ); Mon, 25 Jul 2022 09:32:40 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54118DE96 for ; Mon, 25 Jul 2022 06:32:38 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id a7so3733594vkl.0 for ; Mon, 25 Jul 2022 06:32:38 -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=mq8rVpsA9nDNnsFZV5XL3YFvIErJctRzBpIaaJJkMPw=; b=S7uOJ4nQt/z0rGScaEoG6C7rKnDmRNww1sfiHvqub7g4FmTvUcAo6hzr4xjLkM490g ovbZWgpEXKGL+M4qQEI+lENxkcmAiG5ubR0CPKzzyR4LrvVOG1hYt+gjYwKaH0BuhhdX 4xV8sFOBUduNKJAv96AenyKtyuwpxA5++eZlgc2sZf7WO0hClTbM1/3XLAh4gwYW8tXQ jirAMr+4zFDKD5s2h7ErQ3IlWa/lFM0QTWIiylVbRZWJ6Uqj3mlcRidxbPGKC5G7Mkbb LAwaFeo+NiXDJq8CEEt3/J4cUAm3c+3fZmREp8JYiXxTHmsjbf8DFjS7kc7EBwVyZWYK 0XNQ== 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=mq8rVpsA9nDNnsFZV5XL3YFvIErJctRzBpIaaJJkMPw=; b=1MpZ+CSzc7I+W0cqm+VIn6GHjwMaYmdy4bZfpIr+8j4VSXs28WUxVpGmOLhG5yLvmI KegBQUna8h/ugidNA9zkipcNkbRy0PnFHpcJmKuwtqawDNvHNNdratOM81AZDMvS3rrO lDFsctyKsREAS/HVXfDYKzyecCK35q+1FMJeZCgmUBHae7lYWVVihSDlUFtM/xPDI7Wp OqzFDQuZYcIf+kPT5LsCWkzwnlUf+eAua6/5IDR+PhYvKhbTLA9oyPVHsxH32tZjL7Av vYMkK8dYk/87Q6HkHMYzpyVvZ3WSS0bBM+eAk37HHrbdmrWfW7dIcRoou3b+LLtK6j1f jVHw== X-Gm-Message-State: AJIora9UxO6vIGnB+VbAMxqsoEpoeCghViguaStL9r2SIJCYu56JZ81M yvDZcx826hjVFOzgcxzpYFtrFl/NzgE= X-Google-Smtp-Source: AGRyM1s7HBq4WtcaJ0w6Ughud1gDUL9j4ZUNapOoqtALtkaShHOIapwy1Z1QC5AT/tSMQX8R2qPzLA== X-Received: by 2002:a1f:34d0:0:b0:375:c0d6:79ff with SMTP id b199-20020a1f34d0000000b00375c0d679ffmr3311856vka.37.1658755957339; Mon, 25 Jul 2022 06:32:37 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:36 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 03/11] NFSv4.1 offline trunkable transports on DESTROY_SESSION Date: Mon, 25 Jul 2022 09:32:23 -0400 Message-Id: <20220725133231.4279-4-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 4e0dcc19ca71..3f4e84e9646e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9291,6 +9291,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 Mon Jul 25 13:32:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928063 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 D8A5BC43334 for ; Mon, 25 Jul 2022 13:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232697AbiGYNcp (ORCPT ); Mon, 25 Jul 2022 09:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiGYNcn (ORCPT ); Mon, 25 Jul 2022 09:32:43 -0400 Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC49713DF9 for ; Mon, 25 Jul 2022 06:32:39 -0700 (PDT) Received: by mail-vs1-xe2f.google.com with SMTP id 129so3094672vsq.8 for ; Mon, 25 Jul 2022 06:32:39 -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=teqHuH0ftgyvyp4dgzXH6ChVUVh9xQfAhdQSa6fqtZY=; b=iWtOtPOxIpf8uhPVTyag6zqsATYJCyeEmu26KCbOqVuDsN3aJZuX0rKUAaP8pt6y6y biOVCtGTO4phuPVqhGaDPUYJH6CyCpQzF6AfJeQcW3ne1AM7q2zQph46hjaxzjAf6zp4 XR2QEe2i16c11ob/vVEV7oHvpym+4lneG7RYuY/jFuGB82H4O+kh2arHufQnx5SOgA9E v38CvytWlbQ37baPtRUgJSMLyf+qd+2d1pGMmFLIICMb/x11M1cHOT+dht0X36SztYlu w4GMdDCB6vaWPsMlseDLop3YaNSGtx4YCKyLMIz3rpNkeZvAn8lWlL4PonUfZhaUL9tf dpUA== 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=teqHuH0ftgyvyp4dgzXH6ChVUVh9xQfAhdQSa6fqtZY=; b=PJ6FVB1se1UVV0G8moJ1b2udNnMfVpBTMrhTv9jIT+HBqykGBHAZtUuoem/XXgzM3l sVxPlhc3DGE9l8tlP0VUgg1fQs7eiU8kT+CoJl0dVYt65gyhWDxh6T9o6gEbsVOJBmFw 3/1kjQ53+cA7k6WZT9OkuWxp1hCDnAL90yLblYyCOu/X4pZt9+P7rhM6/kGeu8j8FuDB yfDBNQDqKoiLo253JLYdlWZIp8BGO3Fx6zLOsiv4hAMiuBOKUhnQa3l84+GHhZqGRZk3 V9YIf3j59BwgVU0h77mhnWw/lJfRI1YtybpwIrJuFU7zJowtH/RH+R48yfK0aQyPaaMj YblA== X-Gm-Message-State: AJIora9hoVVgIjNmzlM+p3L79vRClUEMeoGVJX26ggg71EHjbyFZOQCm pFDVP1JqxK4v6OtyWOlgbfFD6W/AOxk= X-Google-Smtp-Source: AGRyM1u4kIpnemli4/XbF248nScp3Up/cU7KoNguI7Qf5GSony7klGcsqfzdm6myg11ZZwZalSEdTw== X-Received: by 2002:a05:6102:334d:b0:358:4e29:4d01 with SMTP id j13-20020a056102334d00b003584e294d01mr2505310vse.31.1658755958560; Mon, 25 Jul 2022 06:32:38 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:38 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 04/11] SUNRPC create an iterator to list only OFFLINE xprts Date: Mon, 25 Jul 2022 09:32:24 -0400 Message-Id: <20220725133231.4279-5-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 2b079c4d8af1..68021b70340d 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 Mon Jul 25 13:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928065 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 23B14C43334 for ; Mon, 25 Jul 2022 13:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235492AbiGYNcr (ORCPT ); Mon, 25 Jul 2022 09:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235468AbiGYNcp (ORCPT ); Mon, 25 Jul 2022 09:32:45 -0400 Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA1A5DF74 for ; Mon, 25 Jul 2022 06:32:41 -0700 (PDT) Received: by mail-vk1-xa2c.google.com with SMTP id a7so3733650vkl.0 for ; Mon, 25 Jul 2022 06:32:41 -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=Y70jAlZuFllBcs0jQL6+urZP8GkrpekIVhztVZKEesg=; b=hQikaHH9gWj/3YMtoGB0sfl+MrlyL7Vbh/PuQoORrcsKO6tVQps0DWW7u0hP4Ayht4 ZZRsGPCiaGTY1vrCpTpfqr8Tb3h1sUgeYNhj6aTKe40PisAxqD3jgLT/k5s5+7KslXzD n8A3UmfL3pvsQU70vaeikZuxDWYPXmt1HgBKSr9xczzlP5OCxO4/tNT2sjMS2Lwl7JfM AqZnsN4F/wmkrPgKqysEqpkwyFiOWp3lHSILQuhbdUKBThrxY3kRqaMs4kucgTdeiSGI kjuqyqZtWbmevXqy4Ep3RRz+UR9yL4Q3fDlnm1vYQzjLvS52GtzNn7UadunoRfkVUVId 1RQg== 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=Y70jAlZuFllBcs0jQL6+urZP8GkrpekIVhztVZKEesg=; b=aAIQn+Y+Dt50KW90itt1myRDL4i0mMmgqheDhfsg/W44LXMliuByXa92O+uyQRZIbD bbmugQJZI+ke4nT9Ph/UJu8QGNch7Hw5mz2mD4Zq0zHUTWKh67bXfSaUeNirJfIzX2eW baGDCF/QWI7ObnlVXVjRCDQECjbDz+MNQqRhbTPMP21NZwytG+47n1Eexicoa0GnWyGz 8XSaN5oOOZf/SKavaN/0Yo0fCbsoDCyFMrkCudixU78V82dfFIPaKUBU4TBUOCtFs8C6 DC4wPje8/bjtYIphhFT3dM+KOcUu8gCOpCBpaFy3FxfYo1qB90t+ASAE6UY6Ly8kf0dw twag== X-Gm-Message-State: AJIora++D6dwkqalW5RvCGb3pFoP2fbnELw4+7m2Yg+dSeP5N478C33L ZZb1OExtLrvEk76jPyreAVA= X-Google-Smtp-Source: AGRyM1t9Dhtyj504K+QVrehSC3GeIOvaREfbDbPDFKte2+Y9iFJws4JrD0Mr/LpMuHs+F9IoEd6YWA== X-Received: by 2002:a1f:48c7:0:b0:376:3a67:4c13 with SMTP id v190-20020a1f48c7000000b003763a674c13mr2386003vka.2.1658755959954; Mon, 25 Jul 2022 06:32:39 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:39 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 05/11] SUNRPC enable back offline transports in trunking discovery Date: Mon, 25 Jul 2022 09:32:25 -0400 Message-Id: <20220725133231.4279-6-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 68021b70340d..9dbce3b0d3a2 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 Mon Jul 25 13:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928064 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 0738BCCA48B for ; Mon, 25 Jul 2022 13:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235264AbiGYNcq (ORCPT ); Mon, 25 Jul 2022 09:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235486AbiGYNcp (ORCPT ); Mon, 25 Jul 2022 09:32:45 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95DA13D02 for ; Mon, 25 Jul 2022 06:32:41 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id 125so10665670vsd.5 for ; Mon, 25 Jul 2022 06:32:41 -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=at3mNlfLOH97Ir0Fdue3RGJuX76dg81P3MvlVlvBCks=; b=CegaW35mSHtigHvCPO/ei2u+dstKR1r22XNzSLAreUAC1FYJmhh39E/iA7T5dHN5yX i1xqJERTl/yIqGY2m5jDrr2Fg1GAQ9K/5muxmfEe3lzxKJaZMgFu8EQgkvgoV9UIVEhR wXS26Q1GhORiLW62csgrFAyZivFZGSnH6xliOqcgc1XPWSXQufh/OOD4m6c7BA7Z4XNz HWp/2DyooWGA+qRtVn63A6QygrD7Cagw3E+FVPb4SRMP3zhmMCrviZs6iuKYjvmrFCm7 B4R3oxBubhSUUlxQ4vgCjsFa7kFQM/fipUlVtwRuU/yJFm96wuquKkydZwMTXy+gGuXh /PlQ== 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=at3mNlfLOH97Ir0Fdue3RGJuX76dg81P3MvlVlvBCks=; b=RKdvUfUYz/m78EBJHs3xT08NQOuSuI1QQTAJYYQ6G/BswG98ahBGX46ZEEka4tx3L3 KClyx9KcOy8rcngvDSdWAsPO+U/vGLhddn+A7S85R3PTtIvI45Iz209i5RZGkZznXlmh oCVzwsvAK0kRCxhmBynKKEfxkTGapxL0YzMGZ8RPWYbBMC+GEsiEGWbtDA3uQyfzmnQ9 2+gc8VdrGr0rNo7Klroh8xJR6Jn8z7ur46x71HkUVIF/TdgUVD4+EibKftjajG3YEPAb jnOYQ9Nli5F2VkcoZDJxU1UQfWGtZNIwntkM5LKLMisMpG53EEXvXcwtVqvg2JkZs6jy DH9g== X-Gm-Message-State: AJIora+rgRc9OOHxU9rmp9JMksE3AclIgvECSSU3HqZGNuUSZ2T5Z0wf 1gPu49tNuqRM7aOKBoTs5ww= X-Google-Smtp-Source: AGRyM1v6Js2mHob8dL6w36sM17dVx3RG8WlXnrNBgiHTkrqtheW2ihfgG63SzjaJUxm9XdBWUM8Qew== X-Received: by 2002:a67:b809:0:b0:358:4c3:c1bf with SMTP id i9-20020a67b809000000b0035804c3c1bfmr3232490vsf.64.1658755961304; Mon, 25 Jul 2022 06:32:41 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:40 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 06/11] SUNRPC create an rpc function that allows xprt removal from rpc_clnt Date: Mon, 25 Jul 2022 09:32:26 -0400 Message-Id: <20220725133231.4279-7-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 | 11 ++++++----- 5 files changed, 24 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 9dbce3b0d3a2..26f3102500bb 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..55da01730311 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) @@ -79,14 +79,15 @@ static void xprt_switch_remove_xprt_locked(struct rpc_xprt_switch *xps, * rpc_xprt_switch_remove_xprt - Removes an rpc_xprt from a rpc_xprt_switch * @xps: pointer to struct rpc_xprt_switch * @xprt: pointer to struct rpc_xprt + * @offline: indicates if the xprt that's being removed is in an offline state * * 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 +156,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 Mon Jul 25 13:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928068 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 375D3C43334 for ; Mon, 25 Jul 2022 13:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235133AbiGYNcz (ORCPT ); Mon, 25 Jul 2022 09:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235049AbiGYNcq (ORCPT ); Mon, 25 Jul 2022 09:32:46 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11567DF7E for ; Mon, 25 Jul 2022 06:32:42 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id a7so3733688vkl.0 for ; Mon, 25 Jul 2022 06:32:42 -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=p/Ff1Wz8vtr24ZP3FEb7/lynhGvGiAjb8N0JIVBZTnk=; b=FVT0kI1gKKCN/nEDvuRsa5Zcw3EY3C+QoaUL1T34hEnTkPdcuFUkkigWIoDhhRYzHQ e1Qz/lRRzxQf+3T2wgFDyLWK7rzurXdJzex6QDTTD9r6S0FMqZ7mND+7QhXGz3/JnpwP 1HcCW7W58KARDwYM1Wt1Ri5/PHg8hYZ5B8vk6bATCiMUokr4EjTEa3i/FTwROHAwbNJe HSlbnzs8VCCrns22OjGxPO19IoYLzWw0rfyK07X+Dcw52ysVWPjFyFk2TmpcpkZViXfA sGuLz30VH588MqK5S4ZNGM7Nh/y5Pf3umsTnPKWEwUPBJwGRMe3EvXTHVgHmAvbky2gl pBdw== 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=p/Ff1Wz8vtr24ZP3FEb7/lynhGvGiAjb8N0JIVBZTnk=; b=McTSbSj6X4cpk58GC+OkaNVSgdqNG8EdHwtFHCaX5lT+PIgCYTeiQpY6j2ay0HSET/ erN+Vf+pU9+Bv4inczRTWUu1Z9sGcV/jyD1geRySnJsWj6BxKrh4HWYjDlfDzz/LUyyd 1SKFzuuuhPglRh7vi49NDT+8u1pr8YmWEjVqaXCMP8k4NZTd36mJ5qz41K9D0VIoULV7 Q4dro5ogW8+QfueDhtOMeEWzSvYGU6kIyA715qUQR9PH0visjsFwn38+G3lDxtJYIdcJ TE2y66J4ITTnKCOQGPNjBFZfnutk8CtnW6ciulB9WTzbv8ONgFWQjIfNpwv/dAKn+xwx kQuQ== X-Gm-Message-State: AJIora/goPp2nquIbwwa/PVDyH5QGK7bAX/8eNvym1JIz0KLUmZgHYn0 5KqjQZzKm18fZmkVXCMIPkVe6lYS0i0= X-Google-Smtp-Source: AGRyM1s0pxZNREyEaaYRaVCHaiVMDbus0EopmzZftuW19cMw2GJ8BK8Xdi69ZDwi4LlV7/u9akdj5Q== X-Received: by 2002:a1f:9f92:0:b0:376:3525:998 with SMTP id i140-20020a1f9f92000000b0037635250998mr2458971vke.41.1658755962513; Mon, 25 Jul 2022 06:32:42 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:42 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 07/11] NFSv4.1 remove xprt from xprt_switch if session trunking test fails Date: Mon, 25 Jul 2022 09:32:27 -0400 Message-Id: <20220725133231.4279-8-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 3f4e84e9646e..4850e29904e6 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -8922,6 +8922,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 Mon Jul 25 13:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928067 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 927ECCCA48B for ; Mon, 25 Jul 2022 13:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235509AbiGYNcy (ORCPT ); Mon, 25 Jul 2022 09:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235333AbiGYNcq (ORCPT ); Mon, 25 Jul 2022 09:32:46 -0400 Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B721FDEB3 for ; Mon, 25 Jul 2022 06:32:44 -0700 (PDT) Received: by mail-vs1-xe2c.google.com with SMTP id c3so10670869vsc.6 for ; Mon, 25 Jul 2022 06:32:44 -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=XxWsksLwNP5augzEl67LHViorzikGGB1fkSMEHJ+uOs=; b=NAyrBMObTiAPltvvN6HLt4OUF8MmoCGTCzy6st2Bu8AjvhlRm1Q5ItErtqBqYiwaky EmAr2vogwb0kwyXGQ12l4GMLuba3gaY7ws7uBf4CAXOlOh+Kmd6e96mVQCMa1/poijqH rUh9j0biZyT6WINVaEuVRCvVRrWkP+vQFb5xMVKPx0zgmvCNMKBv6IKPJPX6cuh/r1U6 tbo/a1gyUJzU0MG40V67vdY8tgQgWx/MvuMGQqRl5VmLQCIdGaa/U8bwc8DIfoOJj+7I GcwSf9osOuErOpynZkkjHD56pwzqHhK5zkmS3Gf8lRGF+he2IED9Y4r8rb7/UTmN7xkx D8Nw== 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=XxWsksLwNP5augzEl67LHViorzikGGB1fkSMEHJ+uOs=; b=N6iW4Pmkv8K5q1fJiDT2vet/k89um0MoVOucHMAzkK3/0N7HpTbb2yRB+ECfqbThq1 lpRbgl2QAIFVRjl/Y5bQ/gqVZALqaC/QH9/IFKmtSm0A2/BoQONh4iLCcYlmgGFuJLO8 iOpU8MBFO5rDbQ1HWtIW4PxPtaTmgK1tjyTJ7JwJ795FhcW7e/J4AvVeZtfZgFOFUjyU 1OpSo9MxhUEb12lG0ns6BildzHvxgcCDHinpLtr2TuCh0q4If5G3hZZte6hsCoCJUeGM RA+8+m4H2GGTAheYHyX2FffPJ/oqR+rq/DJl+WNf+U09scQU8Ewh+CYARjPV0ylExoBr TB7A== X-Gm-Message-State: AJIora8A0ztQu0jzPkctKAvJQrPVGvrUrSdvjpiy1GW2NngYDcMctMdc QcXfDfFymIhODecS0Ma3gDaL3TQQUFk= X-Google-Smtp-Source: AGRyM1snSM9hF/9BenODIijQ4iLcS33i59NJpVcGhttshKD/SrExPt6IX8rjH5tvhOQHXGEU6/CUog== X-Received: by 2002:a67:edc5:0:b0:358:6a1f:552a with SMTP id e5-20020a67edc5000000b003586a1f552amr94249vsp.53.1658755963492; Mon, 25 Jul 2022 06:32:43 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:42 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 08/11] SUNRPC restructure rpc_clnt_setup_test_and_add_xprt Date: Mon, 25 Jul 2022 09:32:28 -0400 Message-Id: <20220725133231.4279-9-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 26f3102500bb..9c9712274ca8 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 Mon Jul 25 13:32:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928066 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 EB6DDC433EF for ; Mon, 25 Jul 2022 13:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbiGYNcw (ORCPT ); Mon, 25 Jul 2022 09:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235509AbiGYNcr (ORCPT ); Mon, 25 Jul 2022 09:32:47 -0400 Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4687FE01D for ; Mon, 25 Jul 2022 06:32:46 -0700 (PDT) Received: by mail-vk1-xa34.google.com with SMTP id y129so5116462vkg.5 for ; Mon, 25 Jul 2022 06:32:45 -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=3FQ5JaSWfv3cXYAVokeJ/mo2/U8O1aJLSFu0DqXZFdU=; b=e9xEW2JvP6XNWIfVm2Gps7ogyM7g7AEBlmEnOBTB2UOq5jKs2FyJzo9vtH/qiOWPPK mHKS9zISQtDHBnWoAFTmdZDhpwFxqdhS2CXHzOeCaVjAfeBybzxGQVXiUBTEtKUKo3/z 6f37hmipnTyAMze+jwaT//W0xVoh0WeDNhrnhi8KTY/FgxoLDGZrYKLy6MIC+sveThn+ L/as/Cc8l4M3MGJbsU90kdYr4sybjwPLoEQ8PeoyEYVS8FlNQBjBt5iExy46LX0ssFBv CFz/vv48xxn9JHeE3qr9Ua5eT4ab4szHK8q6G4BNGO4DFNQbbiRThnH0mWVkVCE+r6mD EjIg== 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=3FQ5JaSWfv3cXYAVokeJ/mo2/U8O1aJLSFu0DqXZFdU=; b=h11YuBQqsPhRbNWLRv9NuR6EocSzPAbyNLEuEwDZmkUzVzuAzVebu1e6pPkjRAHhRP 7TlM1hGfPBMep7mNwMPy1+dooKjI1MIch0KT3jkeFjVlu9mlLx0/If54J+ZXtiqDb91v 6RNqim6VLCpR/O5K4hfqMtto4y1I2icUZSLnp6UuFGPXFEU3yfjDvgPtHeM+Rsx3GKou GMKsDrG0jmwnQHCaH5KJBWfrTQEMgA4XCS1dk8NVk9olVE5dPY+tiKyXuyadRyf32R6S DIWvdOQVVvVdLBtwTiu+iXhf+HOejkRhtfpOvJY25usM0pOsLTWjgGuCvdZK0iUm+d1S EvdQ== X-Gm-Message-State: AJIora93lIngAJSmdWZhqgs82uEqJNTtCfvzGoT+2U7rZ9uqeJvR66l2 wmCtVBdfhkl9G3rCK/jAOQI= X-Google-Smtp-Source: AGRyM1v3LgOAX/9cpUV3U/3i06gKQY0F8nHPWauzP84MG7hUHdBQUznC+yqOyGRI4KGbQ56n2ewObw== X-Received: by 2002:ac5:c38b:0:b0:374:e94e:5454 with SMTP id s11-20020ac5c38b000000b00374e94e5454mr3275057vkk.39.1658755964865; Mon, 25 Jul 2022 06:32:44 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:44 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 09/11] SUNRPC export xprt_iter_rewind function Date: Mon, 25 Jul 2022 09:32:29 -0400 Message-Id: <20220725133231.4279-10-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 55da01730311..685db598acbe 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -481,7 +481,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 Mon Jul 25 13:32:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928069 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 C84E2C433EF for ; Mon, 25 Jul 2022 13:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235596AbiGYNdA (ORCPT ); Mon, 25 Jul 2022 09:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbiGYNcu (ORCPT ); Mon, 25 Jul 2022 09:32:50 -0400 Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 756CF13F07 for ; Mon, 25 Jul 2022 06:32:47 -0700 (PDT) Received: by mail-vk1-xa34.google.com with SMTP id 14so4582313vkj.12 for ; Mon, 25 Jul 2022 06:32:47 -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=74JoiiH+MwVY31GHjxJVwhZK7/xR+Va+xIk9R1BA1Ao=; b=nRh6qDZjrWU/sOKd0cXLS9HZXMN0zSU3DKHfNYTmYVs3BzZ4pGyPT4Ry9KpLUjrVnB LhOe1oe1f8k8dxbhNgPMfKOhs0QjmpYJH6/Z4i3eXU8hGxCAxuD5R4jtHmoHM64veQcC KSfSvV4gKifxpZCxdiadibXvNfOtj1c0vWsZatZzxsvN2Xp72QBv0JghkA8Y/DE7Ge7n TU/txFTmVL4H804xCQfl3AzX3eOSa1Y5F2YlfmT6rtK2/P7WDeV2ZIVUNvdgxDeUmjLD EJvaFqytJGoea5caH8oerkfakNMonDi0jXit6ABCPVBjo+tEHLZbDJjNlXHm9FpLsjaQ ORRw== 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=74JoiiH+MwVY31GHjxJVwhZK7/xR+Va+xIk9R1BA1Ao=; b=WnKi6SZ51bJH44xO5guKuj0Xc/Lbu38xwA3Evj0+0HzkLlaXe1qmoCrACnluXpg8cs sodAASVTwMRaW7nJCj+NOABUO98bYCGFz+ZCUlVBUppIuIET1f32oP8i4p+MNKKzKw10 18uDV1bgSmoaLlAM1DiLCKhIFNdPHRxBw9u4XcKzcVOqCLXpJBjMpNDI3/g2lbcf6kZz WgV0InmT7+1DcxmZsIDVdXejM8eGrRjXlz1SHGHW27fLz07l5IDv74aATfHAoFj/LJu8 DdktcSkh31SBRKZhU9WJ/SraZHLorI6asPFaRtJuqz9tWFHDZg3MgmjwVDAAijC/K9cW TkhQ== X-Gm-Message-State: AJIora8hiEbIN4ulr9njGg9jxhe7tl2u5v4kfGqJTX5Tbx7P7/c9mZ8U QUcggmXUlP1ZQ3VBkDwZVHjq6VGciSc= X-Google-Smtp-Source: AGRyM1swLUXuh4wO+4mUpJap++OrIW1s4kVmQ/erUVwPKXSpAQneBB6hPYZVTQzXFg7GOMKgp3CTLw== X-Received: by 2002:a05:6122:410:b0:374:9b13:daae with SMTP id e16-20020a056122041000b003749b13daaemr3255294vkd.24.1658755965872; Mon, 25 Jul 2022 06:32:45 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:45 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 10/11] SUNRPC create a function that probes only offline transports Date: Mon, 25 Jul 2022 09:32:30 -0400 Message-Id: <20220725133231.4279-11-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 9c9712274ca8..bbfc47f03480 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 Mon Jul 25 13:32:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 12928070 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 D66B9C43334 for ; Mon, 25 Jul 2022 13:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235233AbiGYNdB (ORCPT ); Mon, 25 Jul 2022 09:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235552AbiGYNcv (ORCPT ); Mon, 25 Jul 2022 09:32:51 -0400 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C55DDEB3 for ; Mon, 25 Jul 2022 06:32:48 -0700 (PDT) Received: by mail-vs1-xe36.google.com with SMTP id x125so10659952vsb.13 for ; Mon, 25 Jul 2022 06:32:48 -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=rqgp4NaqHB0e2b8gTbaEiPmf7V2zMSWAxg7BtypCeKw=; b=IOpVavvFo98KTDOOv4PjzLWf+NpfOG6iG2NNbiEyxD2EbJnxRUy9VD3x5dC3I8bSTv VBst9dXzJua4Cx95jTLbkGKf5GC3clIhhASy3gL+I+b1YGjdzMRNJGlzmO0VixsxCKWN bl3PzJD7yiJA9YzjQV9+GchLUhYXydWIW1XEkvz3tEbUMY/IdFt0sMId0de9Vqnh9F+m jGWgwAvtZ110vrOpKZfxu5A9MToKH8zoAZwSOu7cxNrzr3HIfDhtTjw1vSnL1SdDwMSY lPKETzYISxB/NppSdWBC0zAc0GJOD6AJsgXbf5FSA/uUA55ZWI7dTBV4zPY8nhFT1noZ kXxQ== 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=rqgp4NaqHB0e2b8gTbaEiPmf7V2zMSWAxg7BtypCeKw=; b=dZVHiCyDDFv806/WFAbY3860M5qf+lWtZPmSMMjUe/159b/+GhAHwsiet+4jwQGnmG /N75IHhEl8R6ZH8xZjTskn88fPvoE+AUSnH8kua6XkxbAmepJxubvx3ykpEDxk/EpmA/ FygMqwxTzZTKdYS67XCJRZWfAjW+5sNeL4Lt0QpxZCCV2XWfU2lRV9JB8BCV3jTpFcXN 2S2XAmZrAqKBSET08QhXkeiL4jFYq+WSsRpIC1+EszwSgon7e7CNkWAa0OP+VKnD4XVs rdEGZbtPsj3K6hPcCYBvv65m4tbp9CVeVYm/tcdo7Rk36wzqQI/110ANLYpJUKSxxOsH 5knw== X-Gm-Message-State: AJIora/k0sDcBAqRZcuTDMZdF8Jj+236flzy5AfI4bFM7ZVVH21j3w6P +yDSqjS/iSmSfOcgkL72XFw= X-Google-Smtp-Source: AGRyM1tDOYb/Mdoy0tQxrpFnf1K2kKjNJUUkad9xmXKE01fyEKraagApn4TV1UIDNBtiuKyZBLXFoQ== X-Received: by 2002:a05:6102:518:b0:358:5d65:907e with SMTP id l24-20020a056102051800b003585d65907emr1347689vsa.87.1658755966858; Mon, 25 Jul 2022 06:32:46 -0700 (PDT) Received: from localhost.localdomain (071-047-011-047.res.spectrum.com. [71.47.11.47]) by smtp.gmail.com with ESMTPSA id a6-20020ab06306000000b00383aeb53100sm2128826uap.16.2022.07.25.06.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:32:46 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 11/11] NFSv4.1 probe offline transports for trunking on session creation Date: Mon, 25 Jul 2022 09:32:31 -0400 Message-Id: <20220725133231.4279-12-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220725133231.4279-1-olga.kornievskaia@gmail.com> References: <20220725133231.4279-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 4850e29904e6..5f59de55ac84 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9249,6 +9249,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); @@ -9265,6 +9272,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; }