From patchwork Thu Oct 17 17:35:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11196449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 893E113BD for ; Thu, 17 Oct 2019 17:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67CFE21925 for ; Thu, 17 Oct 2019 17:38:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XEMba55B" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503068AbfJQRiC (ORCPT ); Thu, 17 Oct 2019 13:38:02 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:41630 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503066AbfJQRiB (ORCPT ); Thu, 17 Oct 2019 13:38:01 -0400 Received: by mail-qk1-f196.google.com with SMTP id p10so2644712qkg.8 for ; Thu, 17 Oct 2019 10:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=KzDd/kJUTTdo9b021DqcVeh+HNqCV73bsFYcXsRARMs=; b=XEMba55BuJu9UP9MZ+IfCVR1exBQAtiuZJReVEy5NurmLn4gZuX1pltEKMRcBOwNGj s8EQevCagnyxKfrxOa66xF9vVeaSNX4dGeuxzqxTFTwDC3P9aXVEUh0Cm2m1E73sq+jG WaYeVmVrhh42iHiVTp0m0QnRhLYnXZoZu6JLVSIUV878y8NexZjvOQFHPZLNwI1WbvdX 1P4YYlSTyS5ZmgUjjOAZBoMoNP2ufCtE80YQRNOuDxdmNi/6+b7+45+eH216vJfL/HVC VNgYYueWebW3gH6hLBvE1Glui34SdDe9dgCvwlT2M/LLjGSTg2N45GpM+MxtTFgBO1uv T8uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=KzDd/kJUTTdo9b021DqcVeh+HNqCV73bsFYcXsRARMs=; b=WImhTUEGcuj8hbKCQLGBW5nDhQlttoiW49KjHoEUSwhgFz1ane+DgkR7g4kLde1k4z sf5+ZShBPj8EvCbDhZwIWx+nA94xM6njxixkda+4Dx9GanUdlsUWeVrlCmWwLghTcqUm t+OTwckZu+CjY048LRxPXdDCGaTyj3VZgPnmqy3f/UkUeqVngrPHHApCCP8gYFxrR6p/ ku3vDCakwSuam4W+DZKXARS58CS0NWbhsZO+97a/n3orFNGGs3142tDv+wZmBExovMaQ E+XW49boX+rkWy8YjfCNq21JxZWAEKCqnAUWoWfXhe0l1UMN7T8aVFsIw7tlvUby3CFw F44Q== X-Gm-Message-State: APjAAAXQkREdCM0PEWQW39loGt38pOZO+3QvtjHAzwgACB4iNEtU0Pcd KmyZtI1y7uRXNWDZS7qQV7gjKsc= X-Google-Smtp-Source: APXvYqwW9lnITBJdZ8T/alis1aUWOcp4/t+HkR6BqKk2PEAEXhWu5nC94Lo+IkYJsFrNZZL5BnSz6Q== X-Received: by 2002:a37:68e:: with SMTP id 136mr4404009qkg.211.1571333879699; Thu, 17 Oct 2019 10:37:59 -0700 (PDT) Received: from localhost.localdomain ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id l185sm1768610qkd.20.2019.10.17.10.37.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:37:58 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 1/5] NFS: Use non-atomic bit ops when initialising struct nfs_client_initdata Date: Thu, 17 Oct 2019 13:35:44 -0400 Message-Id: <20191017173548.105111-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org We don't need atomic bit ops when initialising a local structure on the stack. Signed-off-by: Trond Myklebust --- fs/nfs/nfs3client.c | 2 +- fs/nfs/nfs4client.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index 148ceb74d27c..178dc102442f 100644 --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -106,7 +106,7 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, cl_init.nconnect = mds_clp->cl_nconnect; if (mds_srv->flags & NFS_MOUNT_NORESVPORT) - set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + __set_bit(NFS_CS_NORESVPORT, &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/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index da6204025a2d..ebc960dd89ff 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -882,11 +882,11 @@ static int nfs4_set_client(struct nfs_server *server, if (minorversion > 0 && proto == XPRT_TRANSPORT_TCP) cl_init.nconnect = nconnect; if (server->flags & NFS_MOUNT_NORESVPORT) - set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); if (server->options & NFS_OPTION_MIGRATION) - set_bit(NFS_CS_MIGRATION, &cl_init.init_flags); + __set_bit(NFS_CS_MIGRATION, &cl_init.init_flags); if (test_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status)) - set_bit(NFS_CS_TSM_POSSIBLE, &cl_init.init_flags); + __set_bit(NFS_CS_TSM_POSSIBLE, &cl_init.init_flags); server->port = rpc_get_port(addr); /* Allocate or find a client reference we can use */ From patchwork Thu Oct 17 17:35:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11196477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C55CB912 for ; Thu, 17 Oct 2019 17:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3D6121835 for ; Thu, 17 Oct 2019 17:38:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rVqaAC49" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503066AbfJQRiC (ORCPT ); Thu, 17 Oct 2019 13:38:02 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46215 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503067AbfJQRiC (ORCPT ); Thu, 17 Oct 2019 13:38:02 -0400 Received: by mail-qt1-f193.google.com with SMTP id u22so4733613qtq.13 for ; Thu, 17 Oct 2019 10:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=91Ar9njuxszKzAtWm4iDPtBww2kCOTgcm5S5GW0aWZc=; b=rVqaAC49daRLXAQctza0v0VkpoWK3Zj2mQs9MBffkAZCdrrWlqq985FIFSp9KaM3GC UwXkOvtpQL6yVQgLebgLVtfV+XCW2RSfnQ4tTJzOasJNLZCyQJ3vveBYfWVPMGXUUT9m o0XknNHIqjHWOYq9rMjGr+rok5Cso7DIe6BsIqazKhH8j4h3mZ3coAMe56MgccVUCuxn 17vfmZVo5+/PTtQurpYkAvNPXAWzoo1hbimXdqqgEVLIEsWx0IjIi2XFDCYhohF3M25E b9cbmfpdLMWj8EkF7hv5Q6WzXc9GM1IcCpuDVHyK7AffJmxLPyg9nvJmpqfOjRbyGeyg CqCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91Ar9njuxszKzAtWm4iDPtBww2kCOTgcm5S5GW0aWZc=; b=nDcNPPI6fkCZE58oZAXXsuo7SN+Dk+4BvheGc2gzkEz1iCLvGzh1E7cqQG/kCIuO0N oCHR/Owc5vozdFUmHtNz7DwhnnY5xId6va90teq87TFORugUhH3vBcdTAlIt1wNMCEdy fismInf7SBFAHMIa78fAC4JXoqmfxTS1RPOWHEwdmIRDAJfqdyWJhVaN3p/WzCga80IL Y/H2wnvR3YKrAgb7K5szExabXsLkIIMMr4oE7AQJ6e23GTQbepC+b2Y3a7RD9iNpXhfP ZeAXxlJavkeRXLUMbCKnCeWRNJ1sG6QsWDsEVn9fby7/gMGb923P46njMBuTQecNSusc K8Gw== X-Gm-Message-State: APjAAAUQrA0bIhFxY+o14hljKBS2GX16V06GXA6QXfIsaL9DBHMUPTd9 E7NqNMF6ofntdixlQcjT7KDu8Gk= X-Google-Smtp-Source: APXvYqz6pw4XRIGO03N/bXIyNwLevWHgWy0bqGoJY4k5hmDInbdvObll3Nl0YEtwOpDouDDDZaKzpg== X-Received: by 2002:a0c:b454:: with SMTP id e20mr5030457qvf.14.1571333880558; Thu, 17 Oct 2019 10:38:00 -0700 (PDT) Received: from localhost.localdomain ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id l185sm1768610qkd.20.2019.10.17.10.37.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:38:00 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/5] NFS: Add a flag to tell nfs_client to set RPC_CLNT_CREATE_NOPING Date: Thu, 17 Oct 2019 13:35:45 -0400 Message-Id: <20191017173548.105111-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191017173548.105111-1-trond.myklebust@hammerspace.com> References: <20191017173548.105111-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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 30838304a0bf..fa7d92328c72 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -515,6 +515,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 47266870a235..a50dd432475b 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 Thu Oct 17 17:35:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11196451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 804EF13BD for ; Thu, 17 Oct 2019 17:38:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F5AA21835 for ; Thu, 17 Oct 2019 17:38:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B+KFLXGL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503076AbfJQRiD (ORCPT ); Thu, 17 Oct 2019 13:38:03 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:34321 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503069AbfJQRiD (ORCPT ); Thu, 17 Oct 2019 13:38:03 -0400 Received: by mail-qt1-f195.google.com with SMTP id 3so4836992qta.1 for ; Thu, 17 Oct 2019 10:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EQCVmpQbShd7J6XF10Iggjgzbj/k5R7KYRToocgx48E=; b=B+KFLXGLr4dE2i2pMfBMdfrNrrAJJWh/mFKHhvSoRlwJnQN59LSYfTd0miJlko4Mbf PYXpWLpYRE+sYF146iFnnGNiC/eCMvQMQ9Oy9yyJm9PKKuugNfOkyBRc6o6HDWD4Fx0y 2iDzyb9PBvWiKkjjXGM4OJX0erTaoFDJO3loMei5hxuRzxkb3neeFaQxAmXZy6Qlq4Lb RAvhgXk32Yn81wuuaZK0T5alQNuIdaCMrJCd6Xo9LEuEElZKQWhjdwd9odaf4D65NcWi H9l9y4FDLx6Z0PP8dZ+TOJtiNnG28BVtpZN1sv4sysKy5eUCME2PZ6U9Lusj6H+/km7Z 1Gqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EQCVmpQbShd7J6XF10Iggjgzbj/k5R7KYRToocgx48E=; b=BDjj/6vEwMxDGsjtOUz0i+Rm2N9NWBkoJCXKyaPsHNy+/sQbNVCONBr5AlJk1fomjo Fc5yU1QOrhYhe0E1UxdSqUbyRsADcETzSLK0pubIFdA+53QJAuAEcdpfVf2NIAUbq2Il x9viMFSibOcuEjSLw1FNmhXFk4xXyH9IMkGFHSiJXp0xbRqAYiWYWN6iovJeUr81sMiG sxXCNiYv1tp3j6HKgpG+tSYCVoWauxtrufKb9GAkmznUfNuD5yArJ8VGXSctO9KMxa4s NmUBJchVUKsg7iTlPXJz+CriCGcQl5V4BAYycOrl9QkmmxjhemkuGzTvV24QO2N2tpzM S/Fg== X-Gm-Message-State: APjAAAVOlw9G0ByuIxTiLmYkZx/j/UgiaJu+UBbooCI4gt+/5kNCbd9N HP6zDBMd1KBtxy4IyWnYkaPBe0s= X-Google-Smtp-Source: APXvYqwxn+zo/8NYNs7RtFU2HA26j7WIH3wBDSqZFhnmx+uCwkdnfV4clD81nunyrfQMPLUPcLm+Jg== X-Received: by 2002:a05:6214:30f:: with SMTP id i15mr5134146qvu.213.1571333881338; Thu, 17 Oct 2019 10:38:01 -0700 (PDT) Received: from localhost.localdomain ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id l185sm1768610qkd.20.2019.10.17.10.38.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:38:00 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 3/5] pNFS: nfs3_set_ds_client should set NFS_CS_NOPING Date: Thu, 17 Oct 2019 13:35:46 -0400 Message-Id: <20191017173548.105111-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191017173548.105111-2-trond.myklebust@hammerspace.com> References: <20191017173548.105111-1-trond.myklebust@hammerspace.com> <20191017173548.105111-2-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- fs/nfs/nfs3client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index 178dc102442f..793fa4273edb 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 Thu Oct 17 17:35:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11196453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C069813BD for ; Thu, 17 Oct 2019 17:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EC2021835 for ; Thu, 17 Oct 2019 17:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HP9I2f/R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503056AbfJQRiE (ORCPT ); Thu, 17 Oct 2019 13:38:04 -0400 Received: from mail-qt1-f175.google.com ([209.85.160.175]:41813 "EHLO mail-qt1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503075AbfJQRiD (ORCPT ); Thu, 17 Oct 2019 13:38:03 -0400 Received: by mail-qt1-f175.google.com with SMTP id c17so1774237qtn.8 for ; Thu, 17 Oct 2019 10:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6nPx5+WD2eQxDAhShqo1QNXmUCu31XjaRYCJQilSiyo=; b=HP9I2f/RkZM50A/eyovtdghhSCIf5EJTsUDLu697mlc4vMQ4bmY7syWvuMJXsE9uVF 8sVDoTwUTz7vp1Mlxh65RFGK9TfzMFdnxDuBb7c4K9NDW7xiinP2Ky8+lrPs60xPzIPd vqgdtRqILdCooq3fZt4/KVToopyYiLZrLNP4/UYX92sLF7xYdMX2Lr9lRlTocjUV+/7T /RCmeCrQ9eTVYqLO/d6cj9xkyu///kxo3kx7JCP7CWgMyNKM4fAneaz7XyrbPI0YbLRV mhPGzEn3GgR+6K+Mr+DcwIeg71UexrWTRyb4NqL8Vdxn3lDo1T3SMXbEVpeM65w/ELqs OTRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6nPx5+WD2eQxDAhShqo1QNXmUCu31XjaRYCJQilSiyo=; b=J43/h5/mAngbTntMRVRt4Zyo9pxouPBXGKMfyrpKzew82tocDG9QvseqsZbRx3zlnB fKtVIDzhNi25dSyQA6p1rDR3reuq1ehHEb9TZeNH0dJvxKIWwK+kpB+MkrbpxXMGOQNa +gc10F5oKkmHIiFJ82Kjpwh2Qi+PS/gNIP8hculc2QChdKbOS8cIkfZ7/exZfOyOhd2k aoz0Knb0Z35xSSW1nAdAD3IoHkx6Q1Du9IdoK5kuERlaH6PwT3Olg5NYOSxFjy+Ca/5b uTJ1Tt6+fwgSZ06JYI3KQcaYxQjy1O//c3SMsKXmA923X4vAg1qQmKkx9rSX8+EYCS8Z a5OA== X-Gm-Message-State: APjAAAWkoxVYv70BHGoWZtQ3erYl8ADagNdVS972z6WRXJEUVcmnTNL4 +piG80rONzWo6jei7sgTw09vcAc= X-Google-Smtp-Source: APXvYqwA9350LMBEGkPX4rLtfjuXderFMaF39uNdZNeRXQZkjgAAek4+sp+P2yf3bPszfARfA+cdRA== X-Received: by 2002:ac8:6782:: with SMTP id b2mr5031544qtp.143.1571333882237; Thu, 17 Oct 2019 10:38:02 -0700 (PDT) Received: from localhost.localdomain ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id l185sm1768610qkd.20.2019.10.17.10.38.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:38:01 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 4/5] NFS/pnfs: Separate NFSv3 DS and MDS traffic Date: Thu, 17 Oct 2019 13:35:47 -0400 Message-Id: <20191017173548.105111-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191017173548.105111-3-trond.myklebust@hammerspace.com> References: <20191017173548.105111-1-trond.myklebust@hammerspace.com> <20191017173548.105111-2-trond.myklebust@hammerspace.com> <20191017173548.105111-3-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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 fa7d92328c72..bd6575ee3b8e 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -312,6 +312,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 793fa4273edb..223904bc40a7 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 a50dd432475b..69e80cef5a81 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 Thu Oct 17 17:35:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11196455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18E1B912 for ; Thu, 17 Oct 2019 17:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB98721A4C for ; Thu, 17 Oct 2019 17:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CyMIBz/8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503075AbfJQRiF (ORCPT ); Thu, 17 Oct 2019 13:38:05 -0400 Received: from mail-qt1-f171.google.com ([209.85.160.171]:44510 "EHLO mail-qt1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503079AbfJQRiE (ORCPT ); Thu, 17 Oct 2019 13:38:04 -0400 Received: by mail-qt1-f171.google.com with SMTP id u40so4742952qth.11 for ; Thu, 17 Oct 2019 10:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VnEbH8L5LvnWiwCCcB3mO2kkaT5bmrMnUS65E8G77Y4=; b=CyMIBz/8vRIibBesd5EJDLh7X8OqlOWjVtFJA9A8/1Gj3YVwi/dWBru9tyWSSBLJlV zpBLTfZjoZFtaoYX705vVhaZCGBTKtUCsbdeGST5GAD+As1hFIuE+DR+5KhL1Wt8TKGB FMpqyzr77NM0lUKCgJ9j7tqXjcI1nhV0F7HrWmO6OAy+Pnma74Er+vLS57mt8WYtzwjn OPc3b+U+qrNu2rGFj0E+J+cGDcws9EwIH1DsETKwHKVfrGQMZGpxah3z/o2A4s9UZdlO FG/hhaNXVfUFbiQrIWuPc1YvZE15qh892GM6/fzvQVHFVsqsX2WFujbFFdwM82MltsF0 EMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VnEbH8L5LvnWiwCCcB3mO2kkaT5bmrMnUS65E8G77Y4=; b=ArWOj2g0CC3vF8BUy4Kjn9H8WdyuNw3zCyct2JMDxuNOn9H+wie1Pzi6B1NOOJ7Mzn Bt6Sr5ka+PJmOOArX1ETWmvh82sPA/KD2xbGIeJoZNOwOcSfUka69vG9LTn4tz006bpV 0HlRyPWIJ4fZoFogm3d3Q9i0uTSHs2HhLCNWzSq3jwdPq/H3XaJcBoxRejaV1OLmBvnX Y1J7GSO3iNeUloWCTfIbcLLBcec1YjNFXCYEojRRKavrSrFYWjnTleVf/7eiK00w/t0B 6ScQQ+ddVCliYfYIU0HbYni8KGCsGH8G7pN3SLkjpoNrygl8f6GnoRDF63oRf/L2DDni ADtA== X-Gm-Message-State: APjAAAWn8ydoAEP1r9p0YKlm6EKfeVqu4ji1MKVUzNot897EHgtKkU/M SsnczNRc+xuNeL+CIvqnJi9iTYA= X-Google-Smtp-Source: APXvYqycgoTfkLuHz+cObTmp9l69jU6CIuZmByrv8RqnzSfule5dnEnytWB+lh0rnVXvp0ZH19HKmA== X-Received: by 2002:a0c:e790:: with SMTP id x16mr5124958qvn.13.1571333883084; Thu, 17 Oct 2019 10:38:03 -0700 (PDT) Received: from localhost.localdomain ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id l185sm1768610qkd.20.2019.10.17.10.38.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:38:02 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 5/5] NFSv4.1: Don't rebind to the same source port when reconnecting to the server Date: Thu, 17 Oct 2019 13:35:48 -0400 Message-Id: <20191017173548.105111-5-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191017173548.105111-4-trond.myklebust@hammerspace.com> References: <20191017173548.105111-1-trond.myklebust@hammerspace.com> <20191017173548.105111-2-trond.myklebust@hammerspace.com> <20191017173548.105111-3-trond.myklebust@hammerspace.com> <20191017173548.105111-4-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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 7d46fafdbbe5..0afb6d59bad0 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -464,7 +464,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 bd6575ee3b8e..02110a30a49e 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -523,6 +523,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; @@ -670,6 +672,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 ebc960dd89ff..abd5af77fe94 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -879,8 +879,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 69e80cef5a81..df61ff8981e8 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 abc63bd1be2b..ec52e78d432b 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 d783e15ba898..ccd35cf4fc41 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 f7f78566be46..5baf9b9be2e8 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) @@ -2906,7 +2909,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(); @@ -2918,6 +2921,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(); @@ -2928,6 +2932,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 70e52f567b2a..98e2d40b2d6a 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1752,7 +1752,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); }