From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam01on0095.outbound.protection.outlook.com ([104.47.32.95]:45505 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965609AbeCHFBA (ORCPT ); Thu, 8 Mar 2018 00:01:00 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Benjamin Coddington , Trond Myklebust , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 057/190] NFS: Fix missing pg_cleanup after nfs_pageio_cond_complete() Date: Thu, 8 Mar 2018 04:59:17 +0000 Message-ID: <20180308045810.8041-57-alexander.levin@microsoft.com> References: <20180308045810.8041-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045810.8041-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Benjamin Coddington [ Upstream commit 43b7d964ed30dbca5c83c90cb010985b429ec4f9 ] Commit a7d42ddb3099727f58366fa006f850a219cce6c8 ("nfs: add mirroring support to pgio layer") moved pg_cleanup out of the path when there was non-sequental I/O that needed to be flushed. The result is that for layouts that have more than one layout segment per file, the pg_lseg is not cleared, so we can end up hitting the WARN_ON_ONCE(req_start >=3D seg_end) = in pnfs_generic_pg_test since the pg_lseg will be pointing to that previously-flushed layout segment. Signed-off-by: Benjamin Coddington Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/pagelist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 3d17fc82b9fe..892c88542ebd 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1262,8 +1262,10 @@ void nfs_pageio_cond_complete(struct nfs_pageio_desc= riptor *desc, pgoff_t index) mirror =3D &desc->pg_mirrors[midx]; if (!list_empty(&mirror->pg_list)) { prev =3D nfs_list_entry(mirror->pg_list.prev); - if (index !=3D prev->wb_index + 1) - nfs_pageio_complete_mirror(desc, midx); + if (index !=3D prev->wb_index + 1) { + nfs_pageio_complete(desc); + break; + } } } } --=20 2.14.1