Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp636084rdb; Sat, 19 Aug 2023 17:30:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFTHnoO2I/oHM2jkpaP6Sajx2p5oklaJBIIxe+iLNsU0n4C+HL6Rwe1XKtxYzsFqUOsf3A X-Received: by 2002:a05:6402:164e:b0:523:ba10:d795 with SMTP id s14-20020a056402164e00b00523ba10d795mr2385865edx.11.1692491454157; Sat, 19 Aug 2023 17:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692491454; cv=none; d=google.com; s=arc-20160816; b=0aBXNMBozXyf6WaQ5EpcBocxzDUBo61piI52pL//CeLzajMd81WEQm5uwgJX8AbpZx JJMRjTBpu6rBOKXiHKifwvbbLryRBFtrJRsQDvVf+RVlC27vMohifHymx6/Y4Zkok610 aI64AIjnhzzS7hY5+NVdwTT3rmgAiu2mBaUkGlhpEY/vfKmGapmjcC48xnNeYiUJcVWR ESVOo22k0PGWm9nmWuELTQ9/teboL/Gohd5e9GhQeuY6aqaK01tjf8Hju+9cQF90FxbB q8RU8FkfB++uZI2frEM+2Ebf8IdWPLkF2zjNQOpDI7psHEhYaWDk+JGGqqdDJ7PY7DzZ M45w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rdNcu+4tbcJOGgD9feFpPPJfTM9HZ3m1bus+oH/NFno=; fh=fCSIe3MjmmvpTcO4md76JKuZjU/cxY+3my+jeGWNbGA=; b=Ij1CloBp3177bcJq2HnqZwfdJzFwa/U5ayIYJKDvnnCFZi5F97iIdHnpW8PFrgk2qh S8+uMlnxvss2vVVhw910W7R53TCi5q+VJbMa7rQpC814NGLD/6MeAxQQm8imFwzESPj5 Mr8wPWV3IbjSpzDvjXkuFAF/lAZuSZg/cFv2VmfSO86cei/FFwMQmzd2cIE7gmLrn6AZ dX7TqdRowNYVIv+oJbKixkkj0eskkPM5jbKg1HuSafhFeYcWUUvtWjoqX2tO+2xqWuEu an38R+TII4jhs9PjPActNdv6epUX80JLD0m/rN+A+oJ9W4emV2Oa3NlYI+pgqwGAEhqs qFpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=II3K8K4E; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p34-20020a056402502200b0052563bff339si3568670eda.286.2023.08.19.17.30.29; Sat, 19 Aug 2023 17:30:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=II3K8K4E; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbjHTATD (ORCPT + 99 others); Sat, 19 Aug 2023 20:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbjHTASj (ORCPT ); Sat, 19 Aug 2023 20:18:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EBCEE28FA for ; Sat, 19 Aug 2023 14:39:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3FEE60304 for ; Sat, 19 Aug 2023 21:39:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC559C433C8; Sat, 19 Aug 2023 21:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692481156; bh=9F0mLVE6Px02gqZkud+RH0Oi+Kkcqan4L3icyQXLzm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=II3K8K4EbnzoAEdVTqeJYtQdyvTpS7tKYA2TtZPpryM3GfO0PJLDKtGhueKsHQNB0 9KfE2q/1oAre0iMwbGmB56WNyFtT1MtLAt8WVwQ539bW4TSz1ov4D3TyoDFtXQoDkG hVE75wP6ExGoZjaoTJNImAM8wvxCLdi3ehUeLKkdrCplncoxP56Z95Z46meqaRGdHF 6ghwlrmK+XmaiHkvnY1pyh85nLCxZPSfyuPw2RAheOPqm6UyvecTioC+GUQDXGSzE6 2CVkJmYDZpF8UZqZQV7Kol9zNQaYmAlQlGqA9qzDU9pkyhOMYlOVdtZErUOQTzVSXl aEaybopBJkqWA== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 5/5] NFS/pNFS: Set the connect timeout for the pNFS flexfiles driver Date: Sat, 19 Aug 2023 17:32:25 -0400 Message-ID: <20230819213225.731214-6-trondmy@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230819213225.731214-5-trondmy@kernel.org> References: <20230819213225.731214-1-trondmy@kernel.org> <20230819213225.731214-2-trondmy@kernel.org> <20230819213225.731214-3-trondmy@kernel.org> <20230819213225.731214-4-trondmy@kernel.org> <20230819213225.731214-5-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Ensure that the connect timeout for the pNFS flexfiles driver is of the same order as the I/O timeout, so that we can fail over quickly when trying to read from a data server that is down. Signed-off-by: Trond Myklebust --- fs/nfs/client.c | 2 ++ fs/nfs/internal.h | 2 ++ fs/nfs/nfs3client.c | 3 +++ fs/nfs/pnfs_nfs.c | 3 +++ 4 files changed, 10 insertions(+) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index e4c5f193ed5e..44eca51b2808 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -517,6 +517,8 @@ int nfs_create_rpc_client(struct nfs_client *clp, .authflavor = flavor, .cred = cl_init->cred, .xprtsec = cl_init->xprtsec, + .connect_timeout = cl_init->connect_timeout, + .reconnect_timeout = cl_init->reconnect_timeout, }; if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 0019c7578f9d..4d80925c94f7 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -82,6 +82,8 @@ struct nfs_client_initdata { const struct rpc_timeout *timeparms; const struct cred *cred; struct xprtsec_parms xprtsec; + unsigned long connect_timeout; + unsigned long reconnect_timeout; }; /* diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index eff3802c5e03..674c012868b1 100644 --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -86,6 +86,7 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans) { struct rpc_timeout ds_timeout; + unsigned long connect_timeout = ds_timeo * (ds_retrans + 1) * HZ / 10; struct nfs_client *mds_clp = mds_srv->nfs_client; struct nfs_client_initdata cl_init = { .addr = ds_addr, @@ -98,6 +99,8 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, .timeparms = &ds_timeout, .cred = mds_srv->cred, .xprtsec = mds_clp->cl_xprtsec, + .connect_timeout = connect_timeout, + .reconnect_timeout = connect_timeout, }; struct nfs_client *clp; char buf[INET6_ADDRSTRLEN + 1]; diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index a0112ad4937a..a08cfda6fff1 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -852,6 +852,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, { struct nfs_client *clp = ERR_PTR(-EIO); struct nfs4_pnfs_ds_addr *da; + unsigned long connect_timeout = timeo * (retrans + 1) * HZ / 10; int status = 0; dprintk("--> %s DS %s\n", __func__, ds->ds_remotestr); @@ -870,6 +871,8 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, .dstaddr = (struct sockaddr *)&da->da_addr, .addrlen = da->da_addrlen, .servername = clp->cl_hostname, + .connect_timeout = connect_timeout, + .reconnect_timeout = connect_timeout, }; if (da->da_transport != clp->cl_proto) -- 2.41.0