Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2656446pxj; Mon, 31 May 2021 07:32:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyk9/ODml1IM/2/rhRaAGDvTNsbTCNGP1kHbNQqGi2uxxtPknXrggkzsfpxjwWsmDUcNVw X-Received: by 2002:a02:3304:: with SMTP id c4mr21052484jae.68.1622471568303; Mon, 31 May 2021 07:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471568; cv=none; d=google.com; s=arc-20160816; b=Dry7rHBwWrZwsVkIGXjFRhRUgK+P5Bmli9JIUnz3SXhZa9BNaIfzeOlxorHXucnphF 85RwPkrr9FeKSNoFJ+OzrxI3CPagegw/sT9ILkvASBtsGQXudLj/VAoEfitJo7P/u91O 0YoFZhsVsZTQX7e9QZ+U9BScgnUHl4rlacb03ru1G7Hg9Vzbc1HHLwR8lIuJ8ruLV0IL 79vCKAAIltC/SUzXA7KT3R/+qWmhhfnp62sA2iS+jQHwYqMB03e0DD7mj7oGZ+N4mCJg kwGaVpicrqbWQogwU4keY5swQH0sw6EQtGz00ok3hMDaShsKbdsWJrGmszyrFqNG5EdK d0UA== 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=FlTjzMFsFQi1yUw5Z6oh4v4f0l1gMuzcse7NVsHynUM=; b=hJmTaNQJrmOX2frnu+IZ4VxOsNExn+5AjowrmLI9V8PkP6b0kmCcIl0logicjx+2Kq fqZdtXHolxJuo7p/IV0C1uiIwyp5F+cEByKSFvAgpUfb+6svN3zDGumr42KJEDSob5o8 Q2GVLbO2+S12znHzj5rPH1D7pCY7t7mz6Kr1qcqL4s5YKUd6sA1/5IZjMUtJ3r2kqH6z l8RVBFcFnujMRxY44omhmGlMLKN9poEM7QJVrVTXaYjhMo14jFLuhYUvHl5jZF1lmshT bWjcqh1X9wP9/cNqc5iN0dpKkKK46FHfalbir4+zTYAjRA5ZEzVrnPhurE2/+0xkX7O2 uNPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CQsFrGkN; 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 r9si12047355ill.162.2021.05.31.07.32.35; Mon, 31 May 2021 07:32: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=CQsFrGkN; 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 S232818AbhEaOdm (ORCPT + 99 others); Mon, 31 May 2021 10:33:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:59498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233284AbhEaNzG (ORCPT ); Mon, 31 May 2021 09:55:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 039696143D; Mon, 31 May 2021 13:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468038; bh=o8d0MYRmFJEVRBRcBij+FPj3htteyd3KcVJ/xoqEwg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQsFrGkNpxsa3FaGe6GNpBHWPomtIulpX++LIErQbXpgeV+Gmro8nTiubuWTECw/h qvIoRhcw5zVGSQAiPIuCh/Eivb5C8GygJJublf4KlQh8exmdm7CYSC0oFyG1MyyKSQ dwvB4jg76T+6DYT0Tv25NDCCY7wb+5uzeLodu5u8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.10 094/252] NFS: Dont corrupt the value of pg_bytes_written in nfs_do_recoalesce() Date: Mon, 31 May 2021 15:12:39 +0200 Message-Id: <20210531130701.163993326@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 @@ -1128,17 +1128,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; + } } } @@ -1228,7 +1227,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;