Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2652230pxa; Mon, 17 Aug 2020 15:34:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzR14vaG6nG/MScPMyVaNAuMeLU9j1iykXyWLsCCdrHpeNJ1ifL5j5+DBofYoYX3as4iep X-Received: by 2002:a17:906:840c:: with SMTP id n12mr16725647ejx.246.1597703647541; Mon, 17 Aug 2020 15:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703647; cv=none; d=google.com; s=arc-20160816; b=kgRVZ4eFELnr2bc8QCZuf2SzPY1jpueOLAuBMz1jilqxnvw7HqRjlwVzfsaYYMOrlM ZMO+HcTQIGAQyzcVmIoSzP2pQeKWJrxbcy9UiZYE2FnH7G3DMffghhmRuQ+KZ1d9pIFK brQO+W/2uzCkLGFfoSNH+rOBf3QmUXtBZNVE/2r1oauVvkGDHhWfqLF4W9GqephNSmGZ RPXP41yDy644uzE1n8hRy+byTYY2Zp/aiqX8TWYNE8601bH7hVFmKB/azLCGlng/wZvI llIDhzaxBaj9RN/8IH81MZ5Ol9Ie50pxWVmxJQ/Yv7Qi+olgLGgYvCvEfimZWB7Z61KP 6qxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6siilt9cGZ/W8HMmzZge6VTn/uPqDIWm0ni+OTDowfg=; b=eLpOz38/ZZoIbGbcKiHgwY4eY84LnnK9yMyypKx6em99KuPchu7O7/FA8YzItRhhkH ayXH7JLbHvUgNST/dDTkgz9kuB1l79d0j/bVDuajoZjgk3s0m9ktDDhv+/z9ccMGbeiC jQYZ9dHOADmhYQmMRAJmzBXRln1ZKXkvjVUiWNQ/mZ+qzTVs6K7Us+G5fxA/xln8EL6H adrA1jzB0AeLe80ykdshd52GlFqHNEAEh9AHHTIOPIONisds2MfLIva0+qQ9smeI8JLf 17TC0U2wIPvEWy4RXJA1hvF8aa50Qx6I348E/rnfc3S4XkYSAS+KzSQO0DxFL4Nan/0d FByQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LY9opn0V; 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=fail (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 be10si11774551edb.574.2020.08.17.15.33.29; Mon, 17 Aug 2020 15:34:07 -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=@kernel.org header.s=default header.b=LY9opn0V; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389269AbgHQRHM (ORCPT + 99 others); Mon, 17 Aug 2020 13:07:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:59836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388461AbgHQQJ0 (ORCPT ); Mon, 17 Aug 2020 12:09:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2E3822CBB; Mon, 17 Aug 2020 16:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680565; bh=sMSJ1v+AsU2GCfmY+AV8iZ7kghNonY2Bav41QQVLTrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY9opn0VQEnCw1zUSU8JFqfHI4dOHA5mRI8ZYXjHc/aCbGYYqhUHrjQZhD+dHolKn BrTxuvnFQZ/UBrZUo5OuUV9npICiORMvWGsQrCEhwIbAJu0uyIJlRhSSURd+2Lc+Pa FZ8T5DZk+bFmcuHZk7lzRk/aU/GJAtooVKv3Ad6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.4 238/270] NFS: Dont move layouts to plh_return_segs list while in use Date: Mon, 17 Aug 2020 17:17:19 +0200 Message-Id: <20200817143807.649098096@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust commit ff041727e9e029845857cac41aae118ead5e261b upstream. If the layout segment is still in use for a read or a write, we should not move it to the layout plh_return_segs list. If we do, we can end up returning the layout while I/O is still in progress. Fixes: e0b7d420f72a ("pNFS: Don't discard layout segments that are marked for return") Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pnfs.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2362,16 +2362,6 @@ out_forget: return ERR_PTR(-EAGAIN); } -static int -mark_lseg_invalid_or_return(struct pnfs_layout_segment *lseg, - struct list_head *tmp_list) -{ - if (!mark_lseg_invalid(lseg, tmp_list)) - return 0; - pnfs_cache_lseg_for_layoutreturn(lseg->pls_layout, lseg); - return 1; -} - /** * pnfs_mark_matching_lsegs_return - Free or return matching layout segments * @lo: pointer to layout header @@ -2408,7 +2398,7 @@ pnfs_mark_matching_lsegs_return(struct p lseg, lseg->pls_range.iomode, lseg->pls_range.offset, lseg->pls_range.length); - if (mark_lseg_invalid_or_return(lseg, tmp_list)) + if (mark_lseg_invalid(lseg, tmp_list)) continue; remaining++; set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);