Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3494210imu; Sun, 11 Nov 2018 16:22:11 -0800 (PST) X-Google-Smtp-Source: AJdET5fwyxCuBzL59RofdxIy0gFUduLA4j2wK4miaScLxf3JO1CvxRkMK+uNAHckDb2JdT7nu3dH X-Received: by 2002:a17:902:a987:: with SMTP id bh7-v6mr2057383plb.46.1541982131637; Sun, 11 Nov 2018 16:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541982131; cv=none; d=google.com; s=arc-20160816; b=HHNDDWGlnuCFxcr8XjrzlFeUdJolhfHBgd6VjhIBU2hniIIkvovAirzE7LzWpJfcI1 1D1Xrul2hyEnGA3IuwaTwVKCFn4WMDtpImQNqIrfeVCy35HvJnN9DmQyqlo0Scw6QwpM X2EGurt11uQJsC0PjKH5DSWDLSV8RG/gKtwrMVfYKjoiY/m/NBMMb3LZY/zxJOQC1rVo y+OoQ+fHa1Rh7nceAK6uG/O28PyQqd2JoL6FHWoC3el7IDDBnakt0j8CoAvzD+cmDNs9 G4jRhRd+R184wiMWRLDwsRbLkFK94Yu4EjCE74dG+/AQjoR+rIUKrGHpreefBwWh/Gxn nD6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xIVEN8K+4pOmfE7xdjRC354gDj8AquvRkQWVamzA83o=; b=SZrTs/OMviGo/LqyQuavZLJZBL6d4rTW5oVcLS8OvwNlmtDvAKcqHd1ZyAfT9q0SNi 1SVLVqwWizc1Og/xdAVMej7ZTcQUUNAk3cG+L0GT5cIBxx8UEvVuzCYjZcgO2r+oL7jC oiEslqUqqlSf3mw/8QdiF8ukqBuofcvRzx+mKNKiAPd3Zw1XaFMjlEOj1BeF08fF2Tvs w4hedrjz82jAxu9ZoK9uQAL9X6DSmXMmexODB8ciuPhHP+Eo4ZS8mxuXdnNmCKOnp4cq nhhqvwmjx0PQ12VOBQAmGQzhDyf1EYj/aAJ7TOB9K/P4O1dq+UGgN6eW4kkJXs3EkUcv b/Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WEq4jCC4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62-v6si17072443pfb.266.2018.11.11.16.21.56; Sun, 11 Nov 2018 16:22:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WEq4jCC4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730070AbeKLKKt (ORCPT + 99 others); Mon, 12 Nov 2018 05:10:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:58420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729725AbeKLIQw (ORCPT ); Mon, 12 Nov 2018 03:16:52 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2D452154B; Sun, 11 Nov 2018 22:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975217; bh=nz5G85LT7ybNW8fl/OgmXS5iUcHjudQtnqLlEhgF8kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEq4jCC4hgmvi9UoZR16IU/McEsfUhxtUNjlbPDxLTYHoQiK4gMYeJgUeYaDw1u5t mT1NcH2sRrSJVFPxxXEJqPnxPLyisE7yjEbCGQ5U1GNoWBzjcS0U8j/PABDvvzW8GF 3SF+8Q1eEyy+U9/I+bTMF/Ocs+hw1zD4TT6bxjV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Junhui , Coly Li , Jens Axboe Subject: [PATCH 4.19 014/361] bcache: correct dirty data statistics Date: Sun, 11 Nov 2018 14:16:01 -0800 Message-Id: <20181111221621.931479446@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tang Junhui commit 2e17a262a2371d38d2ec03614a2675a32cef9912 upstream. When bcache device is clean, dirty keys may still exist after journal replay, so we need to count these dirty keys even device in clean status, otherwise after writeback, the amount of dirty data would be incorrect. Signed-off-by: Tang Junhui Cc: stable@vger.kernel.org Signed-off-by: Coly Li Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1148,11 +1148,12 @@ int bch_cached_dev_attach(struct cached_ } if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) { - bch_sectors_dirty_init(&dc->disk); atomic_set(&dc->has_dirty, 1); bch_writeback_queue(dc); } + bch_sectors_dirty_init(&dc->disk); + bch_cached_dev_run(dc); bcache_device_link(&dc->disk, c, "bdev"); atomic_inc(&c->attached_dev_nr);