From patchwork Sun May 15 01:06:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9095721 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 E24C99F441 for ; Sun, 15 May 2016 01:07:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F13FB20263 for ; Sun, 15 May 2016 01:07:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05B3820268 for ; Sun, 15 May 2016 01:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754003AbcEOBGz (ORCPT ); Sat, 14 May 2016 21:06:55 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:33365 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753999AbcEOBGy (ORCPT ); Sat, 14 May 2016 21:06:54 -0400 Received: by mail-qk0-f196.google.com with SMTP id q184so11339544qkf.0 for ; Sat, 14 May 2016 18:06:53 -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=HtwKMED5OurOwRm2niJG8uITRzGWCuqnXzQToj70Tos=; b=Sr0p+YeFClABVMw2MRYpOWijVVAm7QgxB1c26vyIxSgURdKxaIjYTwn3ooEazBW02G tE6mj8iVDvEJ/NVUMSYwLfGjURjWZplSq/9PQdBBg0fclS5DiYBKiUOBGFTPjEupzr54 6a3U30y/Q0vjynaypNbwAFVwRukspksv7RqyIEsEJ+Itt/Pty/lSScErCP1jfvhdT7+1 8FOpPQZU+z6K2UV8z7YX9CRzvdjUHxZIr6Ds/RxRdce03BQuKaDaKWpIdwLheQSyG3cP Iuj/S2y2jhjbTwjoItml85VXOUKB2MLMznbvngIIk5Q3AvaW+GJLuA5LSpPJCe6+herp tbmg== 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=HtwKMED5OurOwRm2niJG8uITRzGWCuqnXzQToj70Tos=; b=SkAbgpPsiU/rkZ7ATxPieOGNMil07r11K7aGD/kwO1UZC+03srJq2LLWZ9up+ue87y Dvd9Ba+zm9+vo7E8VnSe4jOLyGdb76H946cqh4mXM35lOSxLLTItk/U5AciCk2PdFXmP wVVs2afW/pgeRJFjUqickeB1a4amEDMzg4cnw0GwwpNkn4vPGLhQtD1t9bMOHg7Pv5VS RFBUjVbMneeRzbWdZS9K8b1jgBfUuhiM2NOfOse8w9or9EqPA1PkOqid20ksxW+n1aFz fHcXZY5z6SqqcQp9xY8hFw6oxjdn/V4DAZmrIVWa2TUjlR+Pluw/esEhzBZXUQRBZnIR o5xg== X-Gm-Message-State: AOPr4FW9dMJXjOkWDLdkkVSp3oofJIQ/fpZ9zpj3dKscI076SHMlSG++7Tuot2DB0IMuZw== X-Received: by 10.55.108.7 with SMTP id h7mr23584035qkc.136.1463274413077; Sat, 14 May 2016 18:06:53 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1125:4074:3a60:77ff:fe93:a95d]) by smtp.googlemail.com with ESMTPSA id d12sm11520330qhd.13.2016.05.14.18.06.52 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 May 2016 18:06:52 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, hch@infradead.org Subject: [PATCH v3 01/13] pNFS/flexfile: Fix erroneous fall back to read/write through the MDS Date: Sat, 14 May 2016 21:06:30 -0400 Message-Id: <1463274402-17746-2-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463274402-17746-1-git-send-email-jeff.layton@primarydata.com> References: <1463274402-17746-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: Trond Myklebust This patch fixes a problem whereby the pNFS client falls back to doing reads and writes through the metadata server even when the layout flag FF_FLAGS_NO_IO_THRU_MDS is set. Signed-off-by: Trond Myklebust --- fs/nfs/flexfilelayout/flexfilelayout.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 60d690dbc947..51f6660a2247 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1294,7 +1294,7 @@ ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr) } static bool -ff_layout_reset_to_mds(struct pnfs_layout_segment *lseg, int idx) +ff_layout_device_unavailable(struct pnfs_layout_segment *lseg, int idx) { /* No mirroring for now */ struct nfs4_deviceid_node *node = FF_LAYOUT_DEVID_NODE(lseg, idx); @@ -1331,16 +1331,10 @@ static int ff_layout_read_prepare_common(struct rpc_task *task, rpc_exit(task, -EIO); return -EIO; } - if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { - dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); - if (ff_layout_has_available_ds(hdr->lseg)) - pnfs_read_resend_pnfs(hdr); - else - ff_layout_reset_read(hdr); - rpc_exit(task, 0); + if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) { + rpc_exit(task, -EHOSTDOWN); return -EAGAIN; } - hdr->pgio_done_cb = ff_layout_read_done_cb; ff_layout_read_record_layoutstats_start(task, hdr); return 0; @@ -1530,14 +1524,8 @@ static int ff_layout_write_prepare_common(struct rpc_task *task, return -EIO; } - if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { - bool retry_pnfs; - - retry_pnfs = ff_layout_has_available_ds(hdr->lseg); - dprintk("%s task %u reset io to %s\n", __func__, - task->tk_pid, retry_pnfs ? "pNFS" : "MDS"); - ff_layout_reset_write(hdr, retry_pnfs); - rpc_exit(task, 0); + if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) { + rpc_exit(task, -EHOSTDOWN); return -EAGAIN; } @@ -1754,6 +1742,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) dprintk("%s USE DS: %s cl_count %d vers %d\n", __func__, ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count), vers); + hdr->pgio_done_cb = ff_layout_read_done_cb; atomic_inc(&ds->ds_clp->cl_count); hdr->ds_clp = ds->ds_clp; fh = nfs4_ff_layout_select_ds_fh(lseg, idx);