From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E06DC2BA83 for ; Fri, 14 Feb 2020 17:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D9F8D206B6 for ; Fri, 14 Feb 2020 17:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581702890; bh=RkAkK3r3Uy5zJD5SozveWwmaAWEz+z5hCpz+soPyAyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KhGBp2S4WZmc5DUi4Th9PvjFqmhBxT4UVP4qZLZLPvS/zMDnUTBsEKThAPNLAI0Y3 8enNgkVl9V5xkBwEfCoXi5wQc2BCu1R5m8lKoJspMYMx6X3x/R0+yYqVpEZjuAZegk UzaSgE7rtDQdIvhfeeidQO9sFB3ZukmBtEhnioxc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390113AbgBNRyu (ORCPT ); Fri, 14 Feb 2020 12:54:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:41464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388415AbgBNP55 (ORCPT ); Fri, 14 Feb 2020 10:57:57 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F8C72067D; Fri, 14 Feb 2020 15:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581695876; bh=RkAkK3r3Uy5zJD5SozveWwmaAWEz+z5hCpz+soPyAyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eL2SM9HoFHO7YOyI7SWJ9y1qcjpJ2Nn8LAvDJ6mGCe2qaC3MRWabhJ5oRNTVkTPqg ZWGwbc2aVpN2P8Nt/kJZicHwg1nHJ93IP6BM9PGBjtYuQ1IAmGmfLn+DbgHF85e2f6 8auruGsbxUXxBPT+Q9lRaoOzw1YZ5h9Mdxh0HqAA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anand Jain , philip@philip-seeger.de, Josef Bacik , David Sterba , Sasha Levin , linux-btrfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 421/542] btrfs: device stats, log when stats are zeroed Date: Fri, 14 Feb 2020 10:46:53 -0500 Message-Id: <20200214154854.6746-421-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214154854.6746-1-sashal@kernel.org> References: <20200214154854.6746-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anand Jain [ Upstream commit a69976bc69308aa475d0ba3b8b3efd1d013c0460 ] We had a report indicating that some read errors aren't reported by the device stats in the userland. It is important to have the errors reported in the device stat as user land scripts might depend on it to take the reasonable corrective actions. But to debug these issue we need to be really sure that request to reset the device stat did not come from the userland itself. So log an info message when device error reset happens. For example: BTRFS info (device sdc): device stats zeroed by btrfs(9223) Reported-by: philip@philip-seeger.de Link: https://www.spinics.net/lists/linux-btrfs/msg96528.html Reviewed-by: Josef Bacik Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 72ff80f7f24ca..c5c0dc0cbf517 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7342,6 +7342,8 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info, else btrfs_dev_stat_set(dev, i, 0); } + btrfs_info(fs_info, "device stats zeroed by %s (%d)", + current->comm, task_pid_nr(current)); } else { for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) if (stats->nr_items > i) -- 2.20.1