Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2641240pxj; Mon, 31 May 2021 07:12:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVJkmeGL6vgbOF/UyKza6awqTzcHqoZORZrMq+xPm4JiQpkJVwH+J+9Uw8FHzGPnWKgA0c X-Received: by 2002:a6b:db09:: with SMTP id t9mr4320701ioc.188.1622470328453; Mon, 31 May 2021 07:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470328; cv=none; d=google.com; s=arc-20160816; b=QswHrfWkXb4wqJBnPvA5L2uLykdDlKfLVkLF5TeBINvkEWJtSQTpXqmFcF4OtfTlCB vGRa74BRQ9tt1XOSTpHgMLhvssP1/9eVckPqdYcPkEQ7lkWGrW04rGDk4/NU2BW5CZzj HQXGknlTVueENWHi05TRxAcmQLbsqx314JRWChoKtrcGhXEziyTvyuXc6jqlBAixjflJ EazECuf7ufjzGwipOPtzdGJsYVyDE4WqpvOcNcO6xuB6o0vz3V/QhxBahsL5Q9Q7q2rU CUrJBDTF9dNCJK5uYWYkGnaj4JRg9/FQYRVR+E5qrnBKFJhzwVXiO50zf2lPFWqofXdm s7jQ== 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=Otwu0lVLMl5VcUWqjkYJy7o3bXEt+UiFDeh/Hj68zMU=; b=ZRGIJccXUHm+LKf+YyU3t88NmN8jvCVvv3IJkYT1xSilSo/jYjBIFn9n/+xlx+Y/0S k1RNCiU8LQ8TG9kga/vAFqATyt9SM9fSB2/C7F47zGogoI8Wv5qvGETnY5nwZyEh5ku0 IAU0NVbPNvUEFxTYcFU5wCFX5y/m/E55X8MUn6vPo9I363yO+BkIGc3+yw9NZY9vmk3q 0xjJ8CB5qmDGay4/I2xh32o6PHi37GYPGRvClLMoROll8HsE7ZXFtlgK1eaG148IRMcr QG+52/fEQUGhXXKbdt5tptSM89QvGvShNSDmbQCtbrOh7YHnKE1zazHTEMEHFXoMytym qlvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nWoZNc7k; 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 s6si607313iln.106.2021.05.31.07.11.52; Mon, 31 May 2021 07:12:08 -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=nWoZNc7k; 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 S233381AbhEaOMb (ORCPT + 99 others); Mon, 31 May 2021 10:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:50118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232814AbhEaNpi (ORCPT ); Mon, 31 May 2021 09:45:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C35EF61428; Mon, 31 May 2021 13:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467792; bh=yeK4QSIuwQInUo50dTdpiX7O1gfAmxoFGOPlZSDNhgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWoZNc7kcaRsIkIXcaj6ZXepoYeNEKucmEOCgyoAG5XVPaWRLOLsIAEH9CEldFQ3h SZ0Vu9Z4STQIED7pLdmDaoVQufBjA7odwRN0k6GiMbYx2pLL/EhXLfHO7rksGkSCC5 afeonylm+yUd09jpXZJJRvRcTSJtt8+Uc/rLpN4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.14 36/79] NFS: Dont corrupt the value of pg_bytes_written in nfs_do_recoalesce() Date: Mon, 31 May 2021 15:14:21 +0200 Message-Id: <20210531130637.167248150@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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 0d0ea309357dea0d85a82815f02157eb7fcda39f upstream. The value of mirror->pg_bytes_written should only be updated after a successful attempt to flush out the requests on the list. Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pagelist.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -986,17 +986,16 @@ static void nfs_pageio_doio(struct nfs_p { struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); - if (!list_empty(&mirror->pg_list)) { int error = desc->pg_ops->pg_doio(desc); if (error < 0) desc->pg_error = error; - else + if (list_empty(&mirror->pg_list)) { mirror->pg_bytes_written += mirror->pg_count; - } - if (list_empty(&mirror->pg_list)) { - mirror->pg_count = 0; - mirror->pg_base = 0; + mirror->pg_count = 0; + mirror->pg_base = 0; + mirror->pg_recoalesce = 0; + } } } @@ -1094,7 +1093,6 @@ static int nfs_do_recoalesce(struct nfs_ do { list_splice_init(&mirror->pg_list, &head); - mirror->pg_bytes_written -= mirror->pg_count; mirror->pg_count = 0; mirror->pg_base = 0; mirror->pg_recoalesce = 0;