Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1159635imm; Wed, 1 Aug 2018 11:09:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9L4M7b1vfvSFFxj24rxvab6OibnPd9Ihgms4UYXmTfvQv5QJi0pdaFDDkLICtGuSz4eiy X-Received: by 2002:a62:9cd7:: with SMTP id u84-v6mr27988610pfk.90.1533146999330; Wed, 01 Aug 2018 11:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146999; cv=none; d=google.com; s=arc-20160816; b=bjqs4ZhDwRp8+etKBab/QfzE/PTelS9klag0kJeb/JQGbcMJi/zQoRoVd4G9aFZcXL tpCRMHtyNh4xyV3ZDEOoerA4SF3DZJyUyvgDqYu+8yy0XxmrUE43PuzdPAGpoji6B5gg JsTQWsTSE+bzc8uSKKkHjK1CEpyqaMP9ibPmsevtwNcGxEub6mPO89PfEewugH/m3q+D BToO3fTcDB6kefhDQtPSuCn/5nuk1t8NHsqhwI+F5IlpWs4iagjpLhNrJXfoZ7D7XJYn FZq839n0q6PMFmKy1RouZDY0UlfiEm3MzGwJ/VK23Gqq3QCGwLPGlfp7bD73x5+WtuSQ xsmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=T8Qta/peAY0K8qy1mLbr1V6c8ZlRmp5ExOkMhpCCelY=; b=terZY6D9X8hjC+ubZnpXkL2R+ec5BSE6pLeA1rV2VxB5Z6v0B6aDxd08RmjCacS3jS C3kF7gxH+ka8y7VqtyxjCcroFyHAXswV5beAYBBdWFk3KnKk/nJYsvZyQHnK2U/jQX3U r1p73H/vTIG0UvwjGcAfjo9Zm8wXNntlPx120oOvPHKXfGwP2mKaCS42yQko3fOAUsRq UPlNS7uSoA9kImoa5m1vwcGCPyEhXnuxMVfmmbkstFjHHOw5EhRnc+/sSoQicnJ64MlT BPQZou7/upirwoT12zOl8pv7ALQYZDHBk7cAc5lBP6wDPH4bX7Na+zLm+Urg7FVaz4ci ibIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11-v6si13797145pll.234.2018.08.01.11.09.44; Wed, 01 Aug 2018 11:09:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387472AbeHATzQ (ORCPT + 99 others); Wed, 1 Aug 2018 15:55:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49806 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405748AbeHATIg (ORCPT ); Wed, 1 Aug 2018 15:08:36 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6108E1385; Wed, 1 Aug 2018 17:14:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 023/246] skip LAYOUTRETURN if layout is invalid Date: Wed, 1 Aug 2018 18:48:53 +0200 Message-Id: <20180801165012.806096425@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Olga Kornievskaia [ Upstream commit 93b7f7ad2018d2037559b1d0892417864c78b371 ] Currently, when IO to DS fails, client returns the layout and retries against the MDS. However, then on umounting (inode eviction) it returns the layout again. This is because pnfs_return_layout() was changed in commit d78471d32bb6 ("pnfs/blocklayout: set PNFS_LAYOUTRETURN_ON_ERROR") to always set NFS_LAYOUT_RETURN_REQUESTED so even if we returned the layout, it will be returned again. Instead, let's also check if we have already marked the layout invalid. Signed-off-by: Olga Kornievskaia Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pnfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1126,7 +1126,7 @@ _pnfs_return_layout(struct inode *ino) LIST_HEAD(tmp_list); nfs4_stateid stateid; int status = 0; - bool send; + bool send, valid_layout; dprintk("NFS: %s for inode %lu\n", __func__, ino->i_ino); @@ -1147,6 +1147,7 @@ _pnfs_return_layout(struct inode *ino) goto out_put_layout_hdr; spin_lock(&ino->i_lock); } + valid_layout = pnfs_layout_is_valid(lo); pnfs_clear_layoutcommit(ino, &tmp_list); pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL, 0); @@ -1160,7 +1161,8 @@ _pnfs_return_layout(struct inode *ino) } /* Don't send a LAYOUTRETURN if list was initially empty */ - if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) { + if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) || + !valid_layout) { spin_unlock(&ino->i_lock); dprintk("NFS: %s no layout segments to return\n", __func__); goto out_put_layout_hdr;