From patchwork Fri Aug 17 14:31:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10568911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4EFB139A for ; Fri, 17 Aug 2018 14:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3BC42BC76 for ; Fri, 17 Aug 2018 14:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1BBD2BC0B; Fri, 17 Aug 2018 14:31:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E1132BC0B for ; Fri, 17 Aug 2018 14:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726437AbeHQRfH (ORCPT ); Fri, 17 Aug 2018 13:35:07 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:50678 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbeHQRfG (ORCPT ); Fri, 17 Aug 2018 13:35:06 -0400 Received: by mail-it0-f65.google.com with SMTP id j81-v6so11514634ite.0 for ; Fri, 17 Aug 2018 07:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PY5cv7ZhqNCe3pZYItxDHMLcAslZvl6wxmFalBP94Os=; b=JG6zVAgZ5jN31CZ6AjNhp0eMK2CPY+8Jg7N3jkBew7nupcIDddIHktlFvYqOPV70cS 6f7aC2iqcdouwj5e/MVcbE7jWz4DSY8CaqeeDZrFgQCUkbEwZaxfWqG0PgHRqdkCEZvO frTIx5ElmCig2M1sBy1ZPLmv6WNcXQEjedVvzcNr03ilIF4YS/+riuVXKu+k03g+1tXG YvjyDg2dIsC3g9lX4iJ+18WW1F1PCjedLLG4A2bDgtk8pY8QV6drCH0MxbWO018JoOEb U6RrYPGivYCyGxhTZ4FMkfrmsc32a9zBewxBZePsWar1DV6dMmu+qH2D5dbEhoilltqf h3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PY5cv7ZhqNCe3pZYItxDHMLcAslZvl6wxmFalBP94Os=; b=f7wHpoR6YoqiyB686DNsuBM5AGSAZrG0V0Foew4IRsmv1SXPUuty12dwO7DpFbrLY+ Gr0ADgPFzxtOeGxsYtZlGDUAAYKmfkHGfcCr/uBRK8wkEN153BBVWi+BvkJieCBJrhf6 dGWlp+xfycfz7DvQ4gs54ZYQ2CLRibfNeCCIj43HGenrum4a26rCXuRcsCqtCKkzX7X1 AHqyzTHxHbLcJEnYcVn91E+1+pjsoK+otqBa/qDURo3RwtyDy7m+U/Pu0JmBW8SvMXa0 nB0gYgigA/VjjRAW3bSMQOyD30+bMfD86KaW6ttDbcIy8uzZOM6JQSYnLKr0As/Lf7uv enLw== X-Gm-Message-State: AOUpUlHCriYZ8ZXk2EvOurTCcwNKo+en4oUsfZWkMeT2spwD58sxMsN6 CgOo4vMCFlOCd7XOjJ4IWA== X-Google-Smtp-Source: AA+uWPzZskwqZ749n6Q/zutcsxJBVG5e6hvZO+MaZrx2NTgdK5b4N+IsuewCulzXslCkv82Gh+qR4A== X-Received: by 2002:a24:2f09:: with SMTP id j9-v6mr25080074itj.86.1534516291337; Fri, 17 Aug 2018 07:31:31 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (50-124-244-228.alma.mi.frontiernet.net. [50.124.244.228]) by smtp.gmail.com with ESMTPSA id a64-v6sm1697854itg.40.2018.08.17.07.31.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Aug 2018 07:31:30 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH] pNFS/flexfiles: ff_layout_pg_init_read should exit on error Date: Fri, 17 Aug 2018 10:31:08 -0400 Message-Id: <20180817143108.6504-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Trond Myklebust If we get an error while retrieving the layout, then we should report it rather than falling back to I/O through the MDS. Signed-off-by: Trond Myklebust --- fs/nfs/flexfilelayout/flexfilelayout.c | 28 ++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 280b6b060d53..cae43333ef16 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -812,7 +812,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req, bool strict_iomode) { -retry_strict: pnfs_put_lseg(pgio->pg_lseg); pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, req->wb_context, @@ -825,16 +824,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio, pgio->pg_error = PTR_ERR(pgio->pg_lseg); pgio->pg_lseg = NULL; } - - /* If we don't have checking, do get a IOMODE_RW - * segment, and the server wants to avoid READs - * there, then retry! - */ - if (pgio->pg_lseg && !strict_iomode && - ff_layout_avoid_read_on_rw(pgio->pg_lseg)) { - strict_iomode = true; - goto retry_strict; - } } static void @@ -849,14 +838,16 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, retry: pnfs_generic_pg_check_layout(pgio); /* Use full layout for now */ - if (!pgio->pg_lseg) + if (!pgio->pg_lseg) { ff_layout_pg_get_read(pgio, req, false); - else if (ff_layout_avoid_read_on_rw(pgio->pg_lseg)) + if (!pgio->pg_lseg) + goto out_nolseg; + } + if (ff_layout_avoid_read_on_rw(pgio->pg_lseg)) { ff_layout_pg_get_read(pgio, req, true); - - /* If no lseg, fall back to read through mds */ - if (pgio->pg_lseg == NULL) - goto out_mds; + if (!pgio->pg_lseg) + goto out_nolseg; + } ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx); if (!ds) { @@ -878,6 +869,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; return; +out_nolseg: + if (pgio->pg_error < 0) + return; out_mds: pnfs_put_lseg(pgio->pg_lseg); pgio->pg_lseg = NULL;