Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2624187pxj; Mon, 31 May 2021 06:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRbHE9Om5QMOVvqJ+cciEq0eI71EdBSVt9noPd8VYBP2paM2hvmVrvpwWMqmtkuyJwSEFV X-Received: by 2002:a50:9e2e:: with SMTP id z43mr25153315ede.70.1622469001577; Mon, 31 May 2021 06:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469001; cv=none; d=google.com; s=arc-20160816; b=oJBs+hlkiEW71EECOeoCtpeLTBYUwuNY7/YwDVZkpbhtzRlY+VZNvIuIaCYh3j7eZo J1l8Qcax/p7au/x1zpONipWLdAKcbjZ04jAlPS/CaflGbhqJtv0xEFgPJydgat3z8eWc mSgQ0vn2ZGhY+6jLSbd1gHV2nbOxF2Sa7bQ9VWTQ3gG4NZ9WMwdozMGKQEzR6fGZEyI+ wLy/C8Tv0VxcEXFsjU5h2job55t40IeE1xrnz7QXhtPnqjBfkrLyKkZqKy80vFLBqF9r p08NUzCqlzfPbWvQczLKduUxdO2YcaIj3ya0q9qOqRWC4WwHtci2SH+EbszRhV+I4wuy Xx/A== 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=mLlJG5kWy+BnUfnl3vbzPz065MMLzVUvMpGkJr4/kpQ=; b=SFx/LHohRp7LG++UDkeUk14l/KDS9oJHc9hHvMs9KL8Usis1pxHaTHWF7iBGpKISV1 B6JHH6QH9zHUzXCeOKdPErF1QNzNEbyqydMCqiUwwDd0vWq7Giq388MiTEIoVMqBaAfy IQV1LSeEJ1j4iblslWUVdvreBBSmjo9ADvxPE9V02PVXyZKlJb9Zn4gm4lP+bZ01irf9 Gj/XiRTt8cwUVYmH/5LyNezLlShHzVSvAsciSpBSxYjkvjtVFJimvIZmflcmuopIlpNv r+UyHtYCZIc9WLZKg9gvq7Uowz181s68EKhx5jg5nqVYIjMi+iOqTapJtkNS2MkCmvcf Dk5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vuc8LMN3; 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 hq27si3789549ejc.34.2021.05.31.06.49.38; Mon, 31 May 2021 06:50:01 -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=Vuc8LMN3; 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 S232571AbhEaNrI (ORCPT + 99 others); Mon, 31 May 2021 09:47:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:40218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232136AbhEaNc3 (ORCPT ); Mon, 31 May 2021 09:32:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D96161435; Mon, 31 May 2021 13:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467438; bh=3STy/J+KXQGvw2IIo5JcJiXNLWioShq40qInjhhyVX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vuc8LMN3JN+2sE/x6EdTL2x9NsO6+apAxrPV9vnidFlFmirblSR8JdP28I1yJu2yn 3w7KOs7dVHXXLwFQWDBULSTZ2xaBa8H11FoedfxXq0Qg9RIjZn0+/pl/69V/kc7C7k 1FSuJcmwF5ntomLdnIh9qDctiu9O3rP7q9iXPiEc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.19 064/116] NFS: Dont corrupt the value of pg_bytes_written in nfs_do_recoalesce() Date: Mon, 31 May 2021 15:14:00 +0200 Message-Id: <20210531130642.333988973@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 @@ -987,17 +987,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; + } } } @@ -1095,7 +1094,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;