From patchwork Fri Jan 10 04:26:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 11326587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D88C3138C for ; Fri, 10 Jan 2020 04:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4AD120721 for ; Fri, 10 Jan 2020 04:27:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Me2EJ+kb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731186AbgAJE0m (ORCPT ); Thu, 9 Jan 2020 23:26:42 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:53520 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731162AbgAJE0m (ORCPT ); Thu, 9 Jan 2020 23:26:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00A4NYOg187215 for ; Fri, 10 Jan 2020 04:26:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2019-08-05; bh=j35dgNCgRIgz1WBl0EXUTSdqwQrJ9ZxTo3MEiwlthl4=; b=Me2EJ+kb2Pb9HoL6iTrI+SFXDz6FSPa2ZnmP7+r77bIIchEBXFCdTEWqVCvsOuct0lCj IMQJXpWo7HQuEIezFSL9LX+IiRoXY0ixxrtOTmIjIBf+QvqbVIh3B5f2Syh2kmak9nou PibjiszBVi4fL6lUST1x+kikPt37Xcws1yIO0iJJEDvrUka429QKGrrxiJ28FOeFrEOo Lhjux7FO8H8ZOfobqpR7mV2uJRrAtmXKXv7NpaHXgx1GVTov0k9/kOjrNvdMRXZpjGoR LhXXhMsETdIgFKsJK6aQGx9/b+P8DEHtkAKJSgBMyBFvVV8UfmE+s0FQ3ZrUm6j50AxY JA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2xajnqffqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 10 Jan 2020 04:26:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00A4NhUS095719 for ; Fri, 10 Jan 2020 04:26:39 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 2xdsa5v33r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 10 Jan 2020 04:26:39 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00A4Qc1D003989 for ; Fri, 10 Jan 2020 04:26:38 GMT Received: from mb.wifi.oracle.com (/192.188.170.109) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Jan 2020 20:26:38 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: device stat, log when zeroed assist audit Date: Fri, 10 Jan 2020 12:26:34 +0800 Message-Id: <20200110042634.4843-1-anand.jain@oracle.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9495 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001100037 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9495 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001100037 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 Signed-off-by: Anand Jain --- BTRFS info (device sdc): device stats zeroed by btrfs (9223) The last words are name and pid of the process, unfortunately it came out as 'by btrfs'. At some point if there is a python and lib to reset it would change, otherwise its going to be 'by btrfs', I am ok with it, if otherwise please suggest the alternative. fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index eb55df0d4038..6fd90270e2c7 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7324,6 +7324,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)