From patchwork Thu Dec 1 22:18:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9457157 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 9BA1360235 for ; Thu, 1 Dec 2016 22:19:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E27328540 for ; Thu, 1 Dec 2016 22:19:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8331D28542; Thu, 1 Dec 2016 22:19:29 +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 3EC2B28540 for ; Thu, 1 Dec 2016 22:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759700AbcLAWT2 (ORCPT ); Thu, 1 Dec 2016 17:19:28 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:34580 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758182AbcLAWT1 (ORCPT ); Thu, 1 Dec 2016 17:19:27 -0500 Received: by mail-io0-f194.google.com with SMTP id r94so3916650ioe.1 for ; Thu, 01 Dec 2016 14:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ED0ghcnM/y+H8fkdscp3wuWiK0zZhfM/tFuT6XLrtak=; b=KFBiatYyZBPANlQ/WkkbNTwTIXuKD15apy46L05CHSdlQKtEYQaS/NHi1cLiIGids4 Hdt7ejjBcelQ5cy8azdQkrMlMgsgTpc3/eJEXSaLvOCURwAEfi9Yoli6UE5C5Q/tfvkM 3KNis4fu6QQmaUyGwX4SFFhS0BJ09RC50U/iauJW4JO4LVkZru0ztQyAnpjvL3g9WfLG ukMOmL/WEij7eX8acKSi/hoUgLPFKWPHK8jK0qCGTHBQgE9fxFnmZFmmfE3Z+9283ovt RxJaov+mDnVshoKoPTSyQ8h+sxfBFAc/PhcJhjoHZt2gUFf/YIK+9Ilodaoz4FktECJB y8vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ED0ghcnM/y+H8fkdscp3wuWiK0zZhfM/tFuT6XLrtak=; b=P1idkWPbSoOvAMeINucv+9UpD6S7mulb9VXkf+mK2RLKwTKlSlfh06Zt2ePlnhFtCW xVltE0ygPYDdAHeDIJdqWZxy6Ba+3DOaQ1GqbfkdMRPRC9htH6HQpIv2cqO8Wgl+mWBe K4dBlNsnl9ERhg58i8l9Yr/moj70DPRvdh2gOckLGp0mnWoB7Mlj79NOlqq3zIOmHlqv tBMVAO4uWSiA/3kgQsjokMuhCZR8Gjv3LhyLbS84RPPH+YMShE0o9JkhP5Li0Ax1T2jv jTWuYGisulaqjcxQpVMyu2QDmrZOvrUxVrDV7668VdtF4VWGcmOqM+iIq8sY7y6t/V5X +9fQ== X-Gm-Message-State: AKaTC00gT1oBrmG4GYOsp9l1PeCZi9ZatKoKsbuXpy9gIOTHdk8xJAty0s8SUREvXu3EXw== X-Received: by 10.36.227.78 with SMTP id d75mr48354ith.34.1480630766337; Thu, 01 Dec 2016 14:19:26 -0800 (PST) Received: from leira.trondhjem.org.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id t20sm6532ita.7.2016.12.01.14.19.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 14:19:25 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 02/26] pNFS: Don't clear the layout stateid if a layout return is outstanding Date: Thu, 1 Dec 2016 17:18:58 -0500 Message-Id: <20161201221922.15657-3-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161201221922.15657-2-trond.myklebust@primarydata.com> References: <20161201221922.15657-1-trond.myklebust@primarydata.com> <20161201221922.15657-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 If we no longer hold any layout segments, we're normally expected to consider the layout stateid to be invalid. However we cannot assume this if we're about to, or in the process of sending a layoutreturn. Fixes: 334a8f37115b ("pNFS: Don't forget the layout stateid if...") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.8+ --- fs/nfs/pnfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 206d560c74f4..09bbb07d0494 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -411,7 +411,9 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo, list_del_init(&lseg->pls_list); /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ atomic_dec(&lo->plh_refcount); - if (list_empty(&lo->plh_segs)) { + if (list_empty(&lo->plh_segs) && + !test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) && + !test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) { if (atomic_read(&lo->plh_outstanding) == 0) set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);