Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp303879pxj; Thu, 20 May 2021 09:41:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR7WVtSyt3ARtne1FmYO2H2PmQlqUHO0m85lxGxlKcj9gyoZkkuUMh7q6HKgo0+8mAVW+m X-Received: by 2002:a50:fb17:: with SMTP id d23mr5772942edq.338.1621528870421; Thu, 20 May 2021 09:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621528870; cv=none; d=google.com; s=arc-20160816; b=S/EGHU0Y714CSCgS5pHdhn7Y6g74stfmbb9QEhMPrYQkB/mov/1NQ5+A6YfIBeKq1W Vy0LcTRrkEiBNu79UjAsIW5ADfJz8Bb0a1HH+srduy5082GcKwiILTXr1XQyVMs+4CBR d59KeVWgzXf6f6CJufkB1QbI+i1nyIQO302RWC4mtx1PolRjgZBn6Zk9YD4NITOgPe80 m+y7yVxJoBaGrzDrhtltQQLeusg5FftpF39TCuTUODmN3kioxs6d7eGvfYA+/eXKxtFN sGLdBEZt22l6s2Zkv/y2sQh3YfpeEgpz7FU1wN4AFESsb7qBr/jsR5u65Cv+9QaNHjF1 5W5A== 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=4MgRMktSH6hnfC0eCL5j4CynaQFJZDoz9CRxlJr5i/o=; b=xKxUue3wY0gheVO757cX2fl9prDas/WrGxAz8NgMiYN268jTXHO6QAoBPgYb4KYRTR XZCr/lkkIPSgBsozj6KPItkOejBspfjPUQDFiB1TT6dUd/dYCBKgyBnZENIpd/DsVRiI IDHFt7Pue4I0eNsF9XOczg0qSRQDBerQ50cjCrBudnDPZfzK2Yt+8Hq0p7s8hvJX89ff TvzeQM3e1VeMEnSK8ttO4wgAwfAs6Ves2IKaveWiHEmj6DFYeyFnSgbYH9IrA5DX9xiu YBb79dTMGHHMk54YVHNnWr/0prtVjglVNiV/FNiWWwDab2s8B6YY98+wfoDQoGksCJ12 VW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y27+b0wx; 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 a10si2510612edq.515.2021.05.20.09.40.46; Thu, 20 May 2021 09:41:10 -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=Y27+b0wx; 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 S233233AbhETJpO (ORCPT + 99 others); Thu, 20 May 2021 05:45:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:41292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233358AbhETJmS (ORCPT ); Thu, 20 May 2021 05:42:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 920A0613E3; Thu, 20 May 2021 09:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503142; bh=ReUvWNaX+2lv9IU0ids6Ske0WYXr9DTwvJK8sogaDjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y27+b0wxeiGYBAs5ISRkRTfAvWt2f8OnnXkzbnQIAkKSEZNN4ZV6jF8B/jIgZv4co ekDD9cAGYzy+WwWUZPZCTLUNjlUdNVwYK8ALjMjiR1n/slUHngU2uW8aKiUFO3SU3U 6mpDljOKTluOZKV1yV04PGeQtpXanuExaZw7MmNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.19 088/425] NFS: Dont discard pNFS layout segments that are marked for return Date: Thu, 20 May 2021 11:17:37 +0200 Message-Id: <20210520092134.339969777@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 @@ -2359,6 +2359,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 " @@ -2366,6 +2369,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++;