From patchwork Tue May 2 16:38:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9708319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AC28D6021C for ; Tue, 2 May 2017 16:38:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EE552846A for ; Tue, 2 May 2017 16:38:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93C40284DA; Tue, 2 May 2017 16:38:22 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 2827D2846A for ; Tue, 2 May 2017 16:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751146AbdEBQiS (ORCPT ); Tue, 2 May 2017 12:38:18 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:33053 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbdEBQiR (ORCPT ); Tue, 2 May 2017 12:38:17 -0400 Received: by mail-it0-f66.google.com with SMTP id v135so3026141itv.0 for ; Tue, 02 May 2017 09:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=w8qmpe9CUPx46qvwEbogoD+xTAX6ZXuwUSTQuJUzkR0=; b=fN75ceWFwnlKT7oxCFiSiY4hjh3B5V88iTWZUWlfzVhG1aOOTmmZjx2oLTAYMRhEmo ZO/ymhMm4U3SjY54WIjbqJ5r7k+n+R9GCiyYFKoQPM7brhg4ndWnKTtnUxGiuqEjfwU8 iZA21cHIT8t7UnVH/HBW24Xzz4ARu9D9iQS3r036UBmGHxh3zKfQTTdaInW+8WVNGJl/ xNCaULFL28uy7fldGKTsu7LBc0sKIlNguiC05FNo4gHmnkmQd5YiCGWJhiHl7mppX8Nh jZn8BAXqAYysNrk5uXoez9hzuumxFQTFZQkUGDm1CTZ8Hjnlz0MpB1ljaPd6e3bJqZES Zrhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=w8qmpe9CUPx46qvwEbogoD+xTAX6ZXuwUSTQuJUzkR0=; b=UrA8Tdwj49tH59J/jU570Va4S33EcN/lPuKhiXWl2dpJjDYBIDK1zhlApEIj5Hrnoj SvF66trP44/kIMt4/wv2SrjcfYIFTtUvFvwzHu7DWLfuoNKT9uSTB7q+sqRdVPxVyB2z vSZAxgpQ/VKAtcIk4+HeJrYvldvcijqLeYixiYsOMG+a0qmhDcS3fghbL7Xcj26Qhj10 dkLu2Oxvjwsh1JjzG46j1klcmLbxpMolt1wLU716hh8pBFLtv2lMiMODMiy09X+B9Is6 2p5pcEPoBxJPzlUIJzMR/2ER8xBbkfzvhUvSsjEf/r3ZExIeiDGltqzSSx3Y/sE1n3vQ J6Og== X-Gm-Message-State: AN3rC/4+hFNpffJETS9NkZMYCGoJGN0BQNhVmh2bwgTx5z6UKwiN3ZcB hc4LaXhscocJag== X-Received: by 10.36.84.85 with SMTP id t82mr13355342ita.114.1493743096633; Tue, 02 May 2017 09:38:16 -0700 (PDT) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id f87sm8131322ioj.0.2017.05.02.09.38.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 09:38:16 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 1/3] pNFS: Don't clear the layout return info if there are segments to return Date: Tue, 2 May 2017 12:38:06 -0400 Message-Id: <20170502163812.6211-3-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170502163812.6211-2-trond.myklebust@primarydata.com> References: <20170502163812.6211-1-trond.myklebust@primarydata.com> <20170502163812.6211-2-trond.myklebust@primarydata.com> 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 In pnfs_clear_layoutreturn_info, ensure that we don't clear the layout return info if there are new segments queued for return due to, for instance, a race between a LAYOUTRETURN and a failed I/O attempt. Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 140ecd7d350f..cea1e838efae 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -322,9 +322,15 @@ pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode, static void pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) { + struct pnfs_layout_segment *lseg; lo->plh_return_iomode = 0; lo->plh_return_seq = 0; clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); + list_for_each_entry(lseg, &lo->plh_segs, pls_list) { + if (!test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags)) + continue; + pnfs_set_plh_return_info(lo, lseg->pls_range.iomode, 0); + } } static void pnfs_clear_layoutreturn_waitbit(struct pnfs_layout_hdr *lo) @@ -367,9 +373,9 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg, *next; set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); - pnfs_clear_layoutreturn_info(lo); list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) pnfs_clear_lseg_state(lseg, lseg_list); + pnfs_clear_layoutreturn_info(lo); pnfs_free_returned_lsegs(lo, lseg_list, &range, 0); if (test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags) && !test_and_set_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags))