Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2731123pxj; Mon, 31 May 2021 09:18:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkcax4FZAMfsOOJ874cPDONeXoKpM+y9eHhiwSa9+C/3ORmFO+AT+tE+e8H1VtZ6CnhiFz X-Received: by 2002:a17:906:13cb:: with SMTP id g11mr5847973ejc.169.1622477897314; Mon, 31 May 2021 09:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477897; cv=none; d=google.com; s=arc-20160816; b=yp4LhbKFNAITYA8RAm1PusKmFGghftoMxNRRXnXZu9wclxrIEbgWotqvSTsxVH1NNL 65af1J6ZRO/ygo2BtjQ26HKYdWrSO/PITGDVhdgSpkkO8qJg/FhZQET0IqgCTM7H2H5n eCxOzUGtn1sdCX316NeHR2fCWueGhjTOJ9vRS6tYiGz61UBQRMy3TBm6YHXTdc9ipEC+ UeUQ2ulFhYyJAJ7Ki69q88z+8fKUjvJOjkBsg7a/SmDehPPi9UyRGTHG8sKIGfaVuGaz enGk+yEH6S/LyF/oapGkZ51MihKYSXz5pY/HB+JUPek5dQjuQ/X82fUSzGsO64l62g8d zRjA== 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=LC9o2CZB1vjG520VUDUsNnEHyleIUGGic5ewdTuagUfCg8MOYgzwJFRDzQ1d5JBDMj tF28T9Wi+sw/jIa6sReZxwYVdMkUSgERu6ztI5xjG5z1SPomCPKLhbBXAIlRa4t/Ps7K kL7T3WfJ8ZFNdEjiFLe5FeoTGqVsUIZhlEugpNf/xc5t50cMiBxrHAMvv/W62IoFPO/M nruxX4rRHl2jfeje0FRV33Eyljcny7v8AJIgdQBC7k5dgPyb/85Td4DMNC6kOs9ogWkb FU5GTttOrAnS7lgYZQJfh8aUSWguT3FhFWKeaOoXy6kW1mWcLtgsoshE5XV17FhWX7iG HUzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gwPCY+wt; 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 s18si15145942eji.59.2021.05.31.09.17.54; Mon, 31 May 2021 09:18:17 -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=gwPCY+wt; 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 S233086AbhEaQSg (ORCPT + 99 others); Mon, 31 May 2021 12:18:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233738AbhEaOlg (ORCPT ); Mon, 31 May 2021 10:41:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EEED06188B; Mon, 31 May 2021 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469222; bh=o8d0MYRmFJEVRBRcBij+FPj3htteyd3KcVJ/xoqEwg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwPCY+wtAYxaZKUTHTVa0PR0MOmGeBDk+Q7yrvgu0HLL76HONLCPgBu7BUAL1qUlK lypzTdC/qOH+CYyIqZu/zIQQ1pDEHONLxpb14WvO+dpwOwtvLXmsuDnuAYUp0SWOhU co2VI6CWVxGRdnHQTnsgxo/8yDr2C4wp3zgrotDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.12 115/296] NFS: Dont corrupt the value of pg_bytes_written in nfs_do_recoalesce() Date: Mon, 31 May 2021 15:12:50 +0200 Message-Id: <20210531130707.790572508@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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;