]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: device stats, log when stats are zeroed
authorAnand Jain <anand.jain@oracle.com>
Fri, 10 Jan 2020 04:26:34 +0000 (12:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:38:38 +0000 (08:38 +0100)
[ 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 <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/volumes.c

index 72ff80f7f24caf06a80d797096d6c7e273d522e5..c5c0dc0cbf517198658c5350238689b6e17640c8 100644 (file)
@@ -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)