From patchwork Sat Feb 13 02:01:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 8299301 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 505CDC02AA for ; Sat, 13 Feb 2016 02:07:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 790C6204E0 for ; Sat, 13 Feb 2016 02:07:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87C61204D8 for ; Sat, 13 Feb 2016 02:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750932AbcBMCFi (ORCPT ); Fri, 12 Feb 2016 21:05:38 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:43082 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137AbcBMCCC (ORCPT ); Fri, 12 Feb 2016 21:02:02 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1D21xxl025608 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 13 Feb 2016 02:02:00 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u1D21xZK014195 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 13 Feb 2016 02:01:59 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u1D21xvw022277; Sat, 13 Feb 2016 02:01:59 GMT Received: from localhost.localdomain (/42.60.24.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 12 Feb 2016 18:01:59 -0800 From: Anand Jain To: dsterba@suse.cz Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v2 04/13] btrfs: device path change must be logged Date: Sat, 13 Feb 2016 10:01:31 +0800 Message-Id: <1455328900-1476-5-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455328900-1476-1-git-send-email-anand.jain@oracle.com> References: <1455328900-1476-1-git-send-email-anand.jain@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From the issue diagnosable point of view, log if the device path is changed. Signed-off-by: Anand Jain --- V2: Accepts David's review comment and adds a new ret value 2 for device_list_add() and based on that the caller function would indicate if the path is overwritten (thanks David). fs/btrfs/volumes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 36108e9..76133e0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -585,6 +585,7 @@ void btrfs_free_stale_device(struct btrfs_device *cur_dev) * * Returns: * 1 - first time device is seen + * 2 - device already known but now is overwritten with new path * 0 - device already known * < 0 - error */ @@ -684,6 +685,7 @@ static noinline int device_list_add(const char *path, fs_devices->missing_devices--; device->missing = 0; } + ret = 2; } /* @@ -1080,8 +1082,9 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, ret = device_list_add(path, disk_super, devid, fs_devices_ret); if (ret > 0) { - printk(KERN_INFO "BTRFS: device fsid %pU devid %llu transid %llu %s\n", - disk_super->fsid, devid, transid, path); + printk(KERN_INFO "BTRFS: device fsid %pU devid %llu transid %llu %s %s\n", + disk_super->fsid, devid, transid, path, + ret == 2 ? "(overwritten)":""); ret = 0; } if (!ret && fs_devices_ret)