From patchwork Tue Nov 22 20:39:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1708021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=EoqhKVbe; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NGx372XRwz23nR for ; Wed, 23 Nov 2022 07:40:18 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oxa3r-000690-HS; Tue, 22 Nov 2022 20:40:07 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oxa3q-00068b-5F for kernel-team@lists.ubuntu.com; Tue, 22 Nov 2022 20:40:06 +0000 Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B48393F10B for ; Tue, 22 Nov 2022 20:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669149605; bh=nsYg06nSWRhIg0KgDVa9IogCfoDOq7NnfkAmsB/Gt1Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EoqhKVbeiD/K5jbrS+HN44ynGkOklJ0hqcb1BgtuNBO2WV4J+QmTPpen/QpWz4EI/ rIiwVU6NWNvN2LybcuMGrRpnCYO0RHXa3K4OcTydN4BjaaJvpPqkb0iByTx+VQOgLu 1nMnsyPsPMF8V5s68KnkYHFNDY/OS4TTGDClkM36aMoKtq/gAw2mUIZxG7RxQ9GgOn 3em99/P1zsZrJ98k0lp+Fy5ySsgMjhmOjrXfiYQwjADexohwAyEgFa94vgtYvcfWsi K3n7moI03xu1mjsJp41KRha4yln0If+Ss+p1cCxPcddcDLEuFL8eEtlm1idH1Okd1G uTnUem8a84k/w== Received: by mail-pj1-f69.google.com with SMTP id w2-20020a17090a8a0200b002119ea856edso14659003pjn.5 for ; Tue, 22 Nov 2022 12:40:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nsYg06nSWRhIg0KgDVa9IogCfoDOq7NnfkAmsB/Gt1Q=; b=E6DZW78JxJD2YqfqK1A1d7Tu5pDncYxKf5jl3Pa9SVaKZIwZSlDsTWCBoS6UzLqOfa JsGJgb5RahPuxKaFpKPhh06Ltng36PbUuoTbFz8TZ0UYlWZ3Z4jW0gGGD0eEw4LZuwWH /Mqt2ULQqzTJD0G/h37/jS4VKZ6wmWzI/GnaacQoXH4PVjxZBXPuhJbedabhgWTcAvQV tSmLxcV6B8Q+2L9BVGBDnJxzgfqZC3kVKb17wSCycpNlOeBF6pdFT2BdUOhLvfPqxvJi RRb0znf3ECgMOehrlw62VBkflUGjd+gFy6zTl01MniK7eHlkJ7l7VszcusPhr+gwACRv /jyQ== X-Gm-Message-State: ANoB5pnpF7Pb3u4wPLdEeX46HCEPtvzkP6rL9ZMSqbiowEdPU8BJaDQv Vm1iQ3NOl2AaKpkJ3SPK/akRwlMCW/mBCsDEcH81m0icc9zshYvuhWMqyds30LeDb3VZry+pt0K 3FRYMkwAJQ8RBo/iTZffkEBO+mB59ZpHbsPCuRDvTVA== X-Received: by 2002:a17:903:3295:b0:189:2b93:3faf with SMTP id jh21-20020a170903329500b001892b933fafmr5875690plb.108.1669149604054; Tue, 22 Nov 2022 12:40:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf51xm/nrZhQQmgJc+Giz1MBq79IaCyFs6nFztVX8WgdE7jIMuxOvN5El71s3pjYwvO6sZ5qKw== X-Received: by 2002:a17:903:3295:b0:189:2b93:3faf with SMTP id jh21-20020a170903329500b001892b933fafmr5875671plb.108.1669149603768; Tue, 22 Nov 2022 12:40:03 -0800 (PST) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id d16-20020a170903231000b0017f73caf588sm12502525plh.218.2022.11.22.12.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 12:40:03 -0800 (PST) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4] NFS: Add a flag to tell nfs_client to set RPC_CLNT_CREATE_NOPING Date: Tue, 22 Nov 2022 13:39:11 -0700 Message-Id: <20221122203914.344894-2-tim.gardner@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122203914.344894-1-tim.gardner@canonical.com> References: <20221122203914.344894-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Trond Myklebust BugLink: https://bugs.launchpad.net/bugs/1997488 Add a flag to tell the nfs_client it should set RPC_CLNT_CREATE_NOPING when creating the rpc client. Signed-off-by: Trond Myklebust (cherry picked from commit 4b1b69cedf9de8c203101ea74510c07d428538f7) Signed-off-by: Tim Gardner --- fs/nfs/client.c | 2 ++ include/linux/nfs_fs_sb.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 35abe63655a9..ba9a3c2aa056 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -516,6 +516,8 @@ int nfs_create_rpc_client(struct nfs_client *clp, args.flags |= RPC_CLNT_CREATE_NONPRIVPORT; if (test_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags)) args.flags |= RPC_CLNT_CREATE_INFINITE_SLOTS; + if (test_bit(NFS_CS_NOPING, &clp->cl_flags)) + args.flags |= RPC_CLNT_CREATE_NOPING; if (!IS_ERR(clp->cl_rpcclient)) return 0; diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index a87fe854f008..60cfe90d21dc 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -45,6 +45,7 @@ struct nfs_client { #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ +#define NFS_CS_NOPING 6 /* - don't ping on connect */ struct sockaddr_storage cl_addr; /* server identifier */ size_t cl_addrlen; char * cl_hostname; /* hostname of server */ From patchwork Tue Nov 22 20:39:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1708018 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=tdOQLCmM; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NGx373JlXz23nx for ; Wed, 23 Nov 2022 07:40:18 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oxa3u-00069u-NR; Tue, 22 Nov 2022 20:40:10 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oxa3q-00068j-Tv for kernel-team@lists.ubuntu.com; Tue, 22 Nov 2022 20:40:06 +0000 Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 745CF3F367 for ; Tue, 22 Nov 2022 20:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669149606; bh=eDvchsRWW9fbnXJPo3cZV6zYSm77/plrqAObiWVaabQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tdOQLCmMExgwme0IU3/ILSyJp8xxOUTJlEYLojXmDKUMIHyqzMJeZg8d/AUEyeAmI LAIrDY/i6fPNo0nQdzSefkt7TcdJfBIGdKkHHbud7DrppqwXXVc5RFoh7CZew6tTNe XUWxKWV+lDZZ3TezlmCJgee3oXmL9yWT7/ChTYmyAHcMV7Xyi3xwBSiNWvbvj+qF5z 1mjIQkhmlkVsyjjmUgnaKuL41Eek+LEHpqBXZABvfzOejUPlsyFqYDKERkd6QtSM41 LQ7nK9zCsbITXA5L+bfaZsZE33h8qovWt0oEFLWCZzdyd+vFEmjSzk0o6Vu7VZuBem EdYzgmK6Ug4ww== Received: by mail-pl1-f197.google.com with SMTP id u7-20020a170902e5c700b0018937578945so1411079plf.10 for ; Tue, 22 Nov 2022 12:40:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eDvchsRWW9fbnXJPo3cZV6zYSm77/plrqAObiWVaabQ=; b=1jTRA/L6tyQiK44z1etyxiTN7owdnw1M8yXk0FN2Yv8nNL+TnpB+Heo9T0iSOu1khe bz30GBHQjcc9BERjZBhNCwwkaIhDdtMgAyO1PKptndHg7LOx7LbqVoexmDHpz/Hg7GEh 9YiPKi2lpMXDcg+bK5glkvbFJhtxLKdKfdh5ybxukLiLpIgycgcshe4jG79FmtRCcEuj Cy/22SJoQaAMvFX+F0HiAFSvuOrHHxyRhq/sLW84ea7xjF1l+g5l5hJDUvaEtS7ltq2s aGS4CHlbiJ7fYfpLWOfm+aeemirnrGqv18TLxdN4QjkHvmTFDCRHrvWAjK7wSlv8R2+k 3kgg== X-Gm-Message-State: ANoB5pnmuwRdfPOC/96AmiLRc5p7mEx82VaZmsDyKTux0jg7L114l0bM 8ZdECRzywEt11tPcRLXfu+4JXN1rU6IqPvKDjEUVKKqCKbSFp7ibCg0rEaBE22XZZRNQ+Ohbp0T e/PxM0oTvdKfgWGEZMy4ALVcYGxauUFKlH94JSZN0qA== X-Received: by 2002:a17:903:1c4:b0:186:5ef5:bda1 with SMTP id e4-20020a17090301c400b001865ef5bda1mr5500215plh.78.1669149604797; Tue, 22 Nov 2022 12:40:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Gdis0PGGR/GBEPjcnZYdGEXPoAQeUS/2rSWf+qE45wiQXY+2n+xtPLGMXvc8//y+Kr4h2fQ== X-Received: by 2002:a17:903:1c4:b0:186:5ef5:bda1 with SMTP id e4-20020a17090301c400b001865ef5bda1mr5500203plh.78.1669149604537; Tue, 22 Nov 2022 12:40:04 -0800 (PST) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id d16-20020a170903231000b0017f73caf588sm12502525plh.218.2022.11.22.12.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 12:40:04 -0800 (PST) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/4] pNFS: nfs3_set_ds_client should set NFS_CS_NOPING Date: Tue, 22 Nov 2022 13:39:12 -0700 Message-Id: <20221122203914.344894-3-tim.gardner@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122203914.344894-1-tim.gardner@canonical.com> References: <20221122203914.344894-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Trond Myklebust BugLink: https://bugs.launchpad.net/bugs/1997488 Connecting to the DS is a non-interactive, asynchronous task, so there is no reason to fire up an extra RPC null ping in order to ensure that the server is up. Signed-off-by: Trond Myklebust (cherry picked from commit c6eb58435b98bd843d3179664a0195ff25adb2c3) Signed-off-by: Tim Gardner --- fs/nfs/nfs3client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index 148ceb74d27c..b1f883cfa759 100644 --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -108,6 +108,8 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, if (mds_srv->flags & NFS_MOUNT_NORESVPORT) set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + __set_bit(NFS_CS_NOPING, &cl_init.init_flags); + /* Use the MDS nfs_client cl_ipaddr. */ nfs_init_timeout_values(&ds_timeout, ds_proto, ds_timeo, ds_retrans); clp = nfs_get_client(&cl_init); From patchwork Tue Nov 22 20:39:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1708020 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=YS95KD+o; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NGx372Zc7z23nt for ; Wed, 23 Nov 2022 07:40:18 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oxa3v-0006Ap-U0; Tue, 22 Nov 2022 20:40:11 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oxa3r-00068v-I7 for kernel-team@lists.ubuntu.com; Tue, 22 Nov 2022 20:40:07 +0000 Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 418053F10B for ; Tue, 22 Nov 2022 20:40:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669149607; bh=kvdCqd4STr3T9wE7d5e4W/ZX28++tJD3lyTCkQYamz0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YS95KD+oc3dhnJENq9tbwOqPCorpOFpe+GRaZ+6+WEEyhCuQA9OEbFkgz5pYB94as /U8VU1GsXpFgDaQveVgkDy06UW+fBersfgHbWusWSH5+rTFwvYgVfX6W+oXJPTRglH eIB6NQmZSNOPl+LJ7jXo4j66+Qbaaffxu7wSh0Z6EFq+2HTZ2Zo3+Hu5GDs+o+lu5d gPkorXpfJ/+AflUXAohQ2296J1lWaXFHAVQNqEeJ+Sboe0I/K7MfMoQcjHrO7bmOUL zdjMoyR8TnH7saQ07YWp8gl9IndvtUrln+Uy2qSuW3bs9RErh8nMLzMmUPlUxuLFiq JJuG30Ksc/JWQ== Received: by mail-pj1-f72.google.com with SMTP id lx3-20020a17090b4b0300b002137705324eso1424331pjb.1 for ; Tue, 22 Nov 2022 12:40:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kvdCqd4STr3T9wE7d5e4W/ZX28++tJD3lyTCkQYamz0=; b=p3BMuSFxFXPl9GjbkDDiZAY96O+VtmHizCjmWTidfv3EtJNHDZ80zHmMvtN5j7iY/M kH+1eVDErQsnf3UQ8pJ/MKyKJJ4Bl4K/eyfRbUSN1bJYsT7glxFcdElaI1oKL3WiZTK1 BojCUKsbnuf8O7PS1NAdhZym7VJLxMuN+uBA6lZMu3bC6T1bO4m8cVb95n/6kuk1A+H/ LajcvNzcck0C+XMkTRQ2NyQU4UMAMxoatUjutqn5UiQcAcd/Tfn2vixdlRbsGQnmGpoD gUKn/Mu7uXVtKgCoJqQFHQc8diyZfzxfUYfNJ10q69ffWfEUsrFhXmXvOnvh8YgvAWEp fcpQ== X-Gm-Message-State: ANoB5pl6GqZxVtbFoK0c/ionYfaVkghFKRoVJIzmvabDUQKHfDoUIPT2 ev2yIuWWjE4HSubiCztXxr1uOyUCt6RPzgxuAgiK3/fdfqNSOFlN5fPgPPwJnuiSx+FLWJ1Zb6B n3C7VpmnOSYRKZUh4CNbuLHt3gGbxbwT/ClZjAo0ZSA== X-Received: by 2002:a17:902:db09:b0:186:def0:4886 with SMTP id m9-20020a170902db0900b00186def04886mr8550429plx.152.1669149605537; Tue, 22 Nov 2022 12:40:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GbVWa/ukR/dpQCo0wfDiLoxMRr9LCnYrIVWjsabyqESE5W2U9MVJAuevSxqTYQFkQCVbPwQ== X-Received: by 2002:a17:902:db09:b0:186:def0:4886 with SMTP id m9-20020a170902db0900b00186def04886mr8550414plx.152.1669149605256; Tue, 22 Nov 2022 12:40:05 -0800 (PST) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id d16-20020a170903231000b0017f73caf588sm12502525plh.218.2022.11.22.12.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 12:40:04 -0800 (PST) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/4] NFS/pnfs: Separate NFSv3 DS and MDS traffic Date: Tue, 22 Nov 2022 13:39:13 -0700 Message-Id: <20221122203914.344894-4-tim.gardner@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122203914.344894-1-tim.gardner@canonical.com> References: <20221122203914.344894-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Trond Myklebust BugLink: https://bugs.launchpad.net/bugs/1997488 If a NFSv3 server is being used as both a DS and as a regular NFSv3 server, we may want to keep the IO traffic on a separate TCP connection, since it will typically have very different timeout characteristics. This patch therefore sets up a flag to separate the two modes of operation for the nfs_client. Signed-off-by: Trond Myklebust (cherry picked from commit 52f98f1a2ddd2bb561f2c7e3b19a81d816a63118) Signed-off-by: Tim Gardner --- fs/nfs/client.c | 6 ++++++ fs/nfs/nfs3client.c | 1 + include/linux/nfs_fs_sb.h | 1 + 3 files changed, 8 insertions(+) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index ba9a3c2aa056..b43a931edba5 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -314,6 +314,12 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat /* Match nfsv4 minorversion */ if (clp->cl_minorversion != data->minorversion) continue; + + /* Match request for a dedicated DS */ + if (test_bit(NFS_CS_DS, &data->init_flags) != + test_bit(NFS_CS_DS, &clp->cl_flags)) + continue; + /* Match the full socket address */ if (!rpc_cmp_addr_port(sap, clap)) /* Match all xprt_switch full socket addresses */ diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index b1f883cfa759..be66b4375173 100644 --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -109,6 +109,7 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); __set_bit(NFS_CS_NOPING, &cl_init.init_flags); + __set_bit(NFS_CS_DS, &cl_init.init_flags); /* Use the MDS nfs_client cl_ipaddr. */ nfs_init_timeout_values(&ds_timeout, ds_proto, ds_timeo, ds_retrans); diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 60cfe90d21dc..739cc46412a9 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -46,6 +46,7 @@ struct nfs_client { #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ #define NFS_CS_NOPING 6 /* - don't ping on connect */ +#define NFS_CS_DS 7 /* - Server is a DS */ struct sockaddr_storage cl_addr; /* server identifier */ size_t cl_addrlen; char * cl_hostname; /* hostname of server */ From patchwork Tue Nov 22 20:39:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1708022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=TfstscZ9; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NGx396Krwz23nR for ; Wed, 23 Nov 2022 07:40:21 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oxa40-0006G6-5b; Tue, 22 Nov 2022 20:40:16 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oxa3t-00069O-JO for kernel-team@lists.ubuntu.com; Tue, 22 Nov 2022 20:40:09 +0000 Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A122F3F10B for ; Tue, 22 Nov 2022 20:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669149608; bh=2fy5lDqJGJ+yx9FlQHW6V9oN/xLbqjg46NZyC/Skvls=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TfstscZ9LwpzelH5ey/helMVotjW4tg/yRHQtp+9B6uXB3UmmySi8CU21dY0m7Boc 8/QPOJU9obV4DAomJfZHRcWKVU+qhziR7sYnHYoCSO1ls+inlMi5nJLGK/GEXCHcIJ jpR4QMB6Gz0IVuRSrUoG1X67rQqV2PB18ZfIymnF3uyAWM0Y2KZ9Fr69PL2Xwvn+an auvolG9dzNCG/fddZVKouo12jM5iDwEnuQc8MAVbnmy7/BQEi8FS/iDLy/9/legsqD 7hAdjtuQcR4nfBbeVkpvt0P0WxQIJYwf5FmKNGcq7K3bQc2gn4chYXl+/CcQ2ploEc GHjUd4FYWq69g== Received: by mail-pg1-f198.google.com with SMTP id e190-20020a6369c7000000b004777dc6a02aso3385035pgc.19 for ; Tue, 22 Nov 2022 12:40:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2fy5lDqJGJ+yx9FlQHW6V9oN/xLbqjg46NZyC/Skvls=; b=3KneYbPy2GYsOak5AXcIN80RKnyVI0hNufpaMt7dfDXg5J622IoQjiIcmzleJUXks5 0HJ9pYNkBU01qstpkmqVfQAiKYiIDvCoW1ymM9kd/prMFmsCE76OsKS3lvgZ7oJkeR2D 6VOvZvK86vLql1IW6VYUvwP/k3JUdpi2jMeHrWQ8se5q+qOZHP89RuAUSqp7RIRw2Xo3 D3GeCzTZOUqvpox5dixvu6NJycfynAax36dyqT4HtSSZrw+vvnHPeoKHqPEgE8ekov1o IC/t1AUe/es6hhLzRU4uzsxxFQ3Dg3h49mmvSrjsIIJxmD8ugkUX56usr7WfOtmdCEna YehA== X-Gm-Message-State: ANoB5pnD3M5rkl3it2XArWKATP5q3tFvGYuM+BG8HobsSPH/eGZB3m/y /jdeADuqwzYK/tBLBvnhcN+33dS8fVDBZE7pPI5oBO3dmcxod/F/IPGvEtqiIZ1lN3cVJHW5/sY mnR+ufSrwdwqfmJTw4kKI8/Rg/892cYGC9FA7az96pQ== X-Received: by 2002:a17:902:a5ca:b0:186:bb48:2b34 with SMTP id t10-20020a170902a5ca00b00186bb482b34mr6169088plq.1.1669149606872; Tue, 22 Nov 2022 12:40:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf7d09NRXrn562oXyJGZ96x5nouiuuPgSoJCft93ZrMaDYN0I+si7yovreSe5gp2LX+urnqvvA== X-Received: by 2002:a17:902:a5ca:b0:186:bb48:2b34 with SMTP id t10-20020a170902a5ca00b00186bb482b34mr6169068plq.1.1669149606519; Tue, 22 Nov 2022 12:40:06 -0800 (PST) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id d16-20020a170903231000b0017f73caf588sm12502525plh.218.2022.11.22.12.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 12:40:05 -0800 (PST) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/4] NFSv4.1: Don't rebind to the same source port when reconnecting to the server Date: Tue, 22 Nov 2022 13:39:14 -0700 Message-Id: <20221122203914.344894-5-tim.gardner@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122203914.344894-1-tim.gardner@canonical.com> References: <20221122203914.344894-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Trond Myklebust BugLink: https://bugs.launchpad.net/bugs/1997488 NFSv2, v3 and NFSv4 servers often have duplicate replay caches that look at the source port when deciding whether or not an RPC call is a replay of a previous call. This requires clients to perform strange TCP gymnastics in order to ensure that when they reconnect to the server, they bind to the same source port. NFSv4.1 and NFSv4.2 have sessions that provide proper replay semantics, that do not look at the source port of the connection. This patch therefore ensures they can ignore the rebind requirement. Signed-off-by: Trond Myklebust (cherry picked from commit e6237b6feb37582fbd6bd7a8336d1256a6b4b4f9) Signed-off-by: Tim Gardner --- fs/lockd/host.c | 3 ++- fs/nfs/client.c | 3 +++ fs/nfs/nfs4client.c | 5 ++++- include/linux/nfs_fs_sb.h | 1 + include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 3 ++- net/sunrpc/clnt.c | 7 ++++++- net/sunrpc/xprtsock.c | 2 +- 8 files changed, 20 insertions(+), 5 deletions(-) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 584c03e11844..771c289f6df7 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -459,7 +459,8 @@ nlm_bind_host(struct nlm_host *host) .version = host->h_version, .authflavor = RPC_AUTH_UNIX, .flags = (RPC_CLNT_CREATE_NOPING | - RPC_CLNT_CREATE_AUTOBIND), + RPC_CLNT_CREATE_AUTOBIND | + RPC_CLNT_CREATE_REUSEPORT), .cred = host->h_cred, }; diff --git a/fs/nfs/client.c b/fs/nfs/client.c index b43a931edba5..98f791a914d2 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -524,6 +524,8 @@ int nfs_create_rpc_client(struct nfs_client *clp, args.flags |= RPC_CLNT_CREATE_INFINITE_SLOTS; if (test_bit(NFS_CS_NOPING, &clp->cl_flags)) args.flags |= RPC_CLNT_CREATE_NOPING; + if (test_bit(NFS_CS_REUSEPORT, &clp->cl_flags)) + args.flags |= RPC_CLNT_CREATE_REUSEPORT; if (!IS_ERR(clp->cl_rpcclient)) return 0; @@ -671,6 +673,7 @@ static int nfs_init_server(struct nfs_server *server, .timeparms = &timeparms, .cred = server->cred, .nconnect = data->nfs_server.nconnect, + .init_flags = (1UL << NFS_CS_REUSEPORT), }; struct nfs_client *clp; int error; diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 3671a51fe5eb..70e770b7dd12 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -880,8 +880,11 @@ static int nfs4_set_client(struct nfs_server *server, }; struct nfs_client *clp; - if (minorversion > 0 && proto == XPRT_TRANSPORT_TCP) + if (minorversion == 0) + __set_bit(NFS_CS_REUSEPORT, &cl_init.init_flags); + else if (proto == XPRT_TRANSPORT_TCP) cl_init.nconnect = nconnect; + if (server->flags & NFS_MOUNT_NORESVPORT) set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); if (server->options & NFS_OPTION_MIGRATION) diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 739cc46412a9..41e6de5c3680 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -47,6 +47,7 @@ struct nfs_client { #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ #define NFS_CS_NOPING 6 /* - don't ping on connect */ #define NFS_CS_DS 7 /* - Server is a DS */ +#define NFS_CS_REUSEPORT 8 /* - reuse src port on reconnect */ struct sockaddr_storage cl_addr; /* server identifier */ size_t cl_addrlen; char * cl_hostname; /* hostname of server */ diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 336802acc629..eca293c139b4 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -149,6 +149,7 @@ struct rpc_add_xprt_test { #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) #define RPC_CLNT_CREATE_SOFTERR (1UL << 10) +#define RPC_CLNT_CREATE_REUSEPORT (1UL << 11) struct rpc_clnt *rpc_create(struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 3c6c4b1dbf1a..86fb981adbf0 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -207,7 +207,8 @@ struct rpc_xprt { unsigned int min_reqs; /* min number of slots */ unsigned int num_reqs; /* total slots */ unsigned long state; /* transport state */ - unsigned char resvport : 1; /* use a reserved port */ + unsigned char resvport : 1, /* use a reserved port */ + reuseport : 1; /* reuse port on reconnect */ atomic_t swapper; /* we're swapping over this transport */ unsigned int bind_index; /* bind function index */ diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 1893203cc94f..a6d579bdefd8 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -591,6 +591,9 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) xprt->resvport = 1; if (args->flags & RPC_CLNT_CREATE_NONPRIVPORT) xprt->resvport = 0; + xprt->reuseport = 0; + if (args->flags & RPC_CLNT_CREATE_REUSEPORT) + xprt->reuseport = 1; clnt = rpc_create_xprt(args, xprt); if (IS_ERR(clnt) || args->nconnect <= 1) @@ -2917,7 +2920,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt; unsigned long connect_timeout; unsigned long reconnect_timeout; - unsigned char resvport; + unsigned char resvport, reuseport; int ret = 0; rcu_read_lock(); @@ -2929,6 +2932,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, return -EAGAIN; } resvport = xprt->resvport; + reuseport = xprt->reuseport; connect_timeout = xprt->connect_timeout; reconnect_timeout = xprt->max_reconnect_timeout; rcu_read_unlock(); @@ -2939,6 +2943,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, goto out_put_switch; } xprt->resvport = resvport; + xprt->reuseport = reuseport; if (xprt->ops->set_connect_timeout != NULL) xprt->ops->set_connect_timeout(xprt, connect_timeout, diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 91c8249ee818..68fc5539b123 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1787,7 +1787,7 @@ static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) static void xs_set_srcport(struct sock_xprt *transport, struct socket *sock) { - if (transport->srcport == 0) + if (transport->srcport == 0 && transport->xprt.reuseport) transport->srcport = xs_sock_getport(sock); }