Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2491171pxj; Mon, 10 May 2021 04:23:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOz2vsrBdKd3ySHkYozQDeRYhAXriDUWPe1geZJz3cip5WvtfnT6Omk8gdgh4li6OUNmQj X-Received: by 2002:a05:6402:7d1:: with SMTP id u17mr28970622edy.312.1620645708793; Mon, 10 May 2021 04:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645708; cv=none; d=google.com; s=arc-20160816; b=keV+GncDLuZ1aBsOFhTitDUNMsGet7aRR9XakuSSTx2NBPq0nbyoqBBoKwfbTndQRY 37Ip3ZKkhdcUDfEQKfXvOVVZDWhjZmkP0r1v1ypeudE7EtN7k/l1Q/C08vTnDXMJIbtV 5wNbouRd3roiwQJWaQsdNgNAIvZr1miVEf+SF6D5aJe5m2kNLBIK3tbkoJ3+GOfIQnlb Fe0HyawpNSQhKp/mcxv+Gc7o24t8aFMqAgB6UYWLzJrd2pNJrG+bAGGKG4Xie/gJcRyg 3sAbPeKavgip9h/cWqmir4p1y8sW9rXrlB2i5iwRieK0avmS5A8eSUbOUg+SZnijAeAX aPkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=smb+CU6caTv3r7eJv3/ndnY80bSF5QeqDv7jdDfgt7M=; b=M7HnZup10Nuc5GlgCy0HSL88lfpZ3wuxEyRV1LfJ+ndMGixNXCrAwBxiOj4BVJoDHk 1dGSTc/+YdilXVhTFoSF7dkfXogFfVst7gIRx4iSGvsS/iiri10U4o3vad2rTsNkffv9 MQUGGLuGX914RoridmRK2Wb5wctYYvUwk53BwfWxTHTp/INseK59MbTyDSBp3IbYtphZ ntIGdBlReGfEM1Oc0ObsVmUDon1LF0Zhz6oaYecHUyPZoHyt4OCQUFVixOZKvfnncIgW 7fQLy5PbFIsvt+gV+qOxpeMlJZBFbG0Dr62rlGHAs9ym41eQunvIj3lYEOfF+ZTzz+jt ZMew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cc36IM3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x16si14417264edd.495.2021.05.10.04.21.25; Mon, 10 May 2021 04:21:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cc36IM3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238202AbhEJLRO (ORCPT + 99 others); Mon, 10 May 2021 07:17:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:42198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232825AbhEJKxR (ORCPT ); Mon, 10 May 2021 06:53:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30ACF6101D; Mon, 10 May 2021 10:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643280; bh=dLFfrv2Rnc1w6xd+moC1xTPCS/G+3bi3y8QCG6nK6U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cc36IM3vGskuVk4JPWXjXZJRIMSl/kMl7Zh0CzoquLtwPi0OXgBMLpYa7jSnJ7it7 6IQjJqhq0DuZK8iVioCskzMJYNIYcL54qkbF6QJiROpzppIlfU8Von3gzhVdw623vR cnLkw1UqgCWHQiga7mJiuOQpHOOaielx0K00a/yQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.10 234/299] NFS: Dont discard pNFS layout segments that are marked for return Date: Mon, 10 May 2021 12:20:31 +0200 Message-Id: <20210510102012.686488629@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust commit 39fd01863616964f009599e50ca5c6ea9ebf88d6 upstream. If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN flag, then the assumption is that it has some reporting requirement to perform through a layoutreturn (e.g. flexfiles layout stats or error information). Fixes: e0b7d420f72a ("pNFS: Don't discard layout segments that are marked for return") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pnfs.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2470,6 +2470,9 @@ pnfs_mark_matching_lsegs_return(struct p assert_spin_locked(&lo->plh_inode->i_lock); + if (test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) + tmp_list = &lo->plh_return_segs; + list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) if (pnfs_match_lseg_recall(lseg, return_range, seq)) { dprintk("%s: marking lseg %p iomode %d " @@ -2477,6 +2480,8 @@ pnfs_mark_matching_lsegs_return(struct p lseg, lseg->pls_range.iomode, lseg->pls_range.offset, lseg->pls_range.length); + if (test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags)) + tmp_list = &lo->plh_return_segs; if (mark_lseg_invalid(lseg, tmp_list)) continue; remaining++;