linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
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	[thread overview]
Message-ID: <1455328900-1476-5-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1455328900-1476-1-git-send-email-anand.jain@oracle.com>

>From the issue diagnosable point of view, log if the device path is changed.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 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)
-- 
2.7.0


  parent reply	other threads:[~2016-02-13  2:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-13  2:01 [PATCH resend 00/13] misc patches plus Introduce device delete by devid Anand Jain
2016-02-13  2:01 ` [PATCH v2 01/13] btrfs: pass the error code to the btrfs_std_error and log ret Anand Jain
2016-02-13  2:01 ` [PATCH 02/13] btrfs: create a helper function to read the disk super Anand Jain
2016-02-13  2:01 ` [PATCH v2 03/13] btrfs: maintain consistency in logging to help debugging Anand Jain
2016-02-13  2:01 ` Anand Jain [this message]
2016-02-13  2:01 ` [PATCH 05/13] Btrfs: fix fs logging for multi device Anand Jain
2016-02-13  2:01 ` [PATCH v2 06/13] btrfs: create helper function __check_raid_min_devices() Anand Jain
2016-02-15 14:51   ` David Sterba
2016-02-13  2:01 ` [PATCH 07/13] btrfs: clean up and optimize __check_raid_min_device() Anand Jain
2016-02-13  2:01 ` [PATCH v2 08/13] btrfs: create helper btrfs_find_device_by_user_input() Anand Jain
2016-02-13  2:01 ` [PATCH 09/13] btrfs: make use of btrfs_find_device_by_user_input() Anand Jain
2016-02-15 16:47   ` David Sterba
2016-02-15 16:53     ` David Sterba
2016-02-13  2:01 ` [PATCH v2 10/13] btrfs: enhance btrfs_find_device_by_user_input() to check device path Anand Jain
2016-02-13  2:01 ` [PATCH v2 11/13] btrfs: make use of btrfs_scratch_superblocks() in btrfs_rm_device() Anand Jain
2016-02-13  2:01 ` [PATCH v4 12/13] btrfs: introduce device delete by devid Anand Jain
2016-02-17 10:49   ` David Sterba
2016-02-18  6:59     ` Anand Jain
2016-02-18  9:53       ` David Sterba
2016-02-13  2:01 ` [PATCH 13/13] btrfs: optimize check for stale device Anand Jain
2016-02-18 15:13   ` David Sterba
2016-02-19  7:10     ` Anand Jain
2016-02-19  9:15       ` Anand Jain
2016-03-22 12:21       ` David Sterba
2016-03-22 16:43         ` Anand Jain
2016-03-09  9:54     ` Anand Jain
2016-03-09 16:33       ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455328900-1476-5-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).