From patchwork Tue May 17 16:28:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9114231 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6F5CF9FB14 for ; Tue, 17 May 2016 16:29:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96E38201B9 for ; Tue, 17 May 2016 16:29:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F46F202F0 for ; Tue, 17 May 2016 16:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756182AbcEQQ3B (ORCPT ); Tue, 17 May 2016 12:29:01 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:34438 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755827AbcEQQ3A (ORCPT ); Tue, 17 May 2016 12:29:00 -0400 Received: by mail-qk0-f193.google.com with SMTP id i7so1933568qkd.1 for ; Tue, 17 May 2016 09:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poochiereds-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xXr4+KhMAoJym7qu0psMVB806Vjls2xSMCDvcw0QCHg=; b=BWCTeM1DY/dZTbUHjMR2LM83knV8b492iqOPFq9pQ1DmIPrrZrULpxW7IT1zT/SyNw EA6Wa9RXwtEnVGUiDW4ipTHlpsIe1mBMgbs4rn1vdFdhXnT50wQc1gtpAXzsaUn6VPc+ nSd4ZmPSBZ1f84qEd8xJUm0EK64flwAKumanCz7/EO+ZuGHyFBliUzI6Tu0LXU4/zohv 5Q/3uin+rhlHiMyrOgXnYWLM0RlMnhR1RPfoPTv9olM7t7weZAp7wx0EEBiJhJKNn0ue UjgCf9YI2pB85KCwD2alKHQRTSbZc3oNQxQfHIAoz7MoZO+EGTBimlblVX4SNgEkFxVP Yn5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xXr4+KhMAoJym7qu0psMVB806Vjls2xSMCDvcw0QCHg=; b=N/FYvgzntrxxgkcDvpV8+NPMywcm4ynP+Tlk2NNzhPzW8xJjGROOrxKPRH4tRKk/NF bnOz14WuxD08YKmY+kt3gE+9lH4KbH9wazFjXgdqk0syvEIvHG1nfzS/SbDzc5XI+EYk 1GAbEeutyjeY1H1oQ8hVon9O9OojEwS0E3X3JXcRojymqU6pWSI7bSsHyBLbCntvSskW kcRQ6PizDTdabxHsKfQJZ65fZyA3nG4PA6xxeJ4fosRbUg0x9nDSlqe5QFLi0phqcL4S 8tVDl6sDuifHLnwJ8foe+OPBOvymCC6LWyVw5iAs16OVFhG8h4jbYwboYlU9ZX9+2GC4 FxOA== X-Gm-Message-State: AOPr4FVP97x5RWQKEkqZb//fOC6N2DnaCTqTw7iPPyxW5NdoSTzFDTjlYVQyVPNvGrgRMw== X-Received: by 10.55.178.198 with SMTP id b189mr2510626qkf.98.1463502538462; Tue, 17 May 2016 09:28:58 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1125:4074:3a60:77ff:fe93:a95d]) by smtp.googlemail.com with ESMTPSA id a31sm1685827qga.34.2016.05.17.09.28.57 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 May 2016 09:28:57 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: Trond Myklebust , Anna Schumaker Cc: Thomas Haynes , linux-nfs@vger.kernel.org, hch@lst.de Subject: [PATCH v4 03/13] pNFS/flexfiles: When initing reads or writes, we might have to retry connecting to DSes Date: Tue, 17 May 2016 12:28:38 -0400 Message-Id: <1463502528-11519-4-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463502528-11519-1-git-send-email-jeff.layton@primarydata.com> References: <1463502528-11519-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Haynes If we are initializing reads or writes and can not connect to a DS, then check whether or not IO is allowed through the MDS. If it is allowed, reset to the MDS. Else, fail the layout segment and force a retry of a new layout segment. Signed-off-by: Tom Haynes --- fs/nfs/flexfilelayout/flexfilelayout.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index f538ca6bbe81..f58cd2a14d5e 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -847,8 +847,13 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, goto out_mds; ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx); - if (!ds) - goto out_mds; + if (!ds) { + if (ff_layout_no_fallback_to_mds(pgio->pg_lseg)) + goto out_pnfs; + else + goto out_mds; + } + mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); pgio->pg_mirror_idx = ds_idx; @@ -862,6 +867,12 @@ out_mds: pnfs_put_lseg(pgio->pg_lseg); pgio->pg_lseg = NULL; nfs_pageio_reset_read_mds(pgio); + return; + +out_pnfs: + pnfs_set_lo_fail(pgio->pg_lseg); + pnfs_put_lseg(pgio->pg_lseg); + pgio->pg_lseg = NULL; } static void @@ -904,8 +915,12 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, for (i = 0; i < pgio->pg_mirror_count; i++) { ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true); - if (!ds) - goto out_mds; + if (!ds) { + if (ff_layout_no_fallback_to_mds(pgio->pg_lseg)) + goto out_pnfs; + else + goto out_mds; + } pgm = &pgio->pg_mirrors[i]; mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].wsize; @@ -917,6 +932,12 @@ out_mds: pnfs_put_lseg(pgio->pg_lseg); pgio->pg_lseg = NULL; nfs_pageio_reset_write_mds(pgio); + return; + +out_pnfs: + pnfs_set_lo_fail(pgio->pg_lseg); + pnfs_put_lseg(pgio->pg_lseg); + pgio->pg_lseg = NULL; } static unsigned int