All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
@ 2016-04-02  1:30 Anand Jain
  2016-04-02  1:30 ` [PATCH 01/13] btrfs: Introduce a new function to check if all chunks a OK for degraded mount Anand Jain
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

Thanks for various comments, tests and feedback.

Background: Hot spare and Auto replace:
 Hot spare is predominately used to mitigate or narrow the time
 window of a degraded mode, during which any further disk
 failure might lead to a catastrophic data loss. Data center
 storage generally will have couple of disks reserved as spares
 on the storage, so that it will automatically kickin to resilver
 the storage pool so that the pool is back to a healthy state.
 Mainly this is an storage feature rather than a FS feature,
 I believe people acquainted with enterprise storage use cases
 will appreciate the need of it, and so most/all of the enterprise
 storage has hot spare feature.

Btrfs device states:
 This patch-set adds 'failed' state and makes provision to use
 'offline' state as two new device states. So to summarize
 various device states and their meanings..

 /* missing: device wasn't found at the time of mount */
 int missing;

 /*
  * failed: device confirmed to have experienced critical
  * io failure
  */
 int failed;

 /*
  * offline: When there is no confirmation that a disk has
  * failed. But an interim communication breakdown
  * and not necessarily a candidate for the device replace.
  * Device might be online after user intervention or after
  * block transport layer error recovery.
  */
 int offline;


Device state transition Tuning and visualization:
 Sysfs interfaces are planned to provide the required tuning for
 device state transition, sensitivities and visualization of device
 states. However sysfs framework which could provide such an interface
 is being reviewed/tested and not yet ready as of now. So for the
 testing and debug of these features here I have used an update
 version of the procfs patch which is in the ML.

  [PATCH] btrfs: debug: procfs-devlist: introduce procfs interface for
the device list for debugging

 I find the above patch very useful, easy to use (as compared to
 sysfs to visualize the device state) and stable.

This patch set does not depend on any of the sysfs patches as such.

Backward compatibility:
 Adds a new incompatibility feature flags
 (BTRFS_FEATURE_INCOMPAT_SPARE_DEV) to manage the spare device
 when older kernels are used. So it is tested to be work fine
 with older kernel/prog versions.


Auto replace:
 Replace happens automatically, that is when there is any write
 failed or flush failed, the device will be marked as failed, which
 will stop any further IO attempt to that device. And in the next
 commit cycle the auto replace will pick the spare device to
 replace the failed device. And so the btrfs volume is back to a
 healthy state.

Per FSID spare vs Global spare:
 As of now only global hot spare is supported, that is hot spare(s)
 are for all the btrfs FS in the system. However future there will
 be a fs_info->no_auto_replace tunable which can be tuned by the user
 to limit the use of global spare.


Example use case:
 Here below is an example use case of the hot spare setup.

 Add a spare device:
        btrfs spare add /dev/sde -f

 If there is a spare device which is already added before the,
 just run

        btrfs dev scan [/dev/sde]

 Which will register the spare device to the kernel.

        btrfs fi show
         Label: none uuid: 52f170c1-725c-457d-8cfd-d57090460091
          Total devices 2 FS bytes used 112.00KiB
          devid 1 size 2.00GiB used 417.50MiB path /dev/sdc
          devid 2 size 2.00GiB used 417.50MiB path /dev/sdd

        Global spare
          device size 3.00GiB path /dev/sde


Patches:

Kernel:
 First, it needs, Qu's per chunk missing device patchset, which is
 part of the set.

 Next patches 6-9 adds support for Spare device. For kernel without
 spare feature the spare device is kept away. And when the kernel
 supports the spare device, it will inhibit from mounting it. Further
 these patch set provides helper function to pick a spare device and
 release a spare device back to the spare device pool.

 Patch 10 provides helper function to auto replace.
 Patch 11 provides helper function to bring a device to failed state.
 Patch 12 marks a device as failed based on flush and write errors,
  and avoids any further IO to it.
 Last 13 triggers auto replace.

Progs:
 Needs below 4 patches which will add sub cli 'spare' to manage
 the spare device. As of now deleting a spare device has to be
 managed using wipefs. However in the long run we would a proper
 btrfs command to do that job.

V2->V3:
Kernel:
  Thanks to Yauhen and Austin for the review comments.
  Again split Patch 11 and 12 which was merged in V2 for better.
  Patch numbers are reordered (sorry about that) but for better.
  Fix rcu issue in btrfs_get_spare_device(), we don't need rcu
   as its under uuid_mutex
  Fix rcu issue and to check for replace lock at
   btrfs_auto_replace_start()
  Cleanup old: casualty_kthread() new: health_kthread() with
    changes as per
    838fe188 'btrfs: cleaner_kthread() doesn't need explicit freeze'
    (thanks Yauhen)
  Yauhen reported this issue:
	When a disk is removed through the virtualbox interface.
	BUG: unable to handle kernel NULL pointer dereference at 0000000000000548
	IP: generic_make_request_checks+0x4d/0x910
	::
 	bvec_alloc+0x5e/0x100
	generic_make_request+0x24/0x290
	submit_bio+0x67/0x140
	finish_rmw+0x409/0x570 [btrfs]
	full_stripe_write+0xa5/0xb0 [btrfs]
	raid56_parity_write+0xf5/0x180 [btrfs]
	btrfs_map_bio+0x105/0x300 [btrfs]
	btrfs_get_extent+0x83/0xb20 [btrfs]

	Status: So far the raid group profile would adapt to lower suitable
	group profile when device is missing/failed. This appears to
	be not happening with RAID56 OR there are stale IO which wasn't
	flushed out. Anyway to have this fixed I am moving the patch
	  btrfs: introduce device dynamic state transition to offline or failed
	to the top in v3,
	But firstly we need a reliable test case, or a very carefully
	crafted test case which can create this situation.

Progs:
  No change, same as V2.

V1->V2:
Kernel:
 (Based on tests and commets provided in the ML)
 a. Now transition_kthread() wakes up the casualty_kthread to check
    for device states. Instead of doing that in the transition_kthread()
    itself. Cleaner and less pressure on transition_kthread().
 b. Dropped
     [PATCH 05/15] btrfs: optimize btrfs_check_degradable() for calls outside of barrier
    as it was wrong patch and the optimization was incomplete.
 c. Merged patches
    btrfs: check for failed device and hot replace
      to
    btrfs: check device for critical errors and mark failed
    in an effort to make the changes as in a above.

Progs:
 a. Added to call btrfs_register_one_device() when doing btrfs
    spare add

Anand Jain (8):
  btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV
  btrfs: add check not to mount a spare device
  btrfs: support btrfs dev scan for spare device
  btrfs: provide framework to get and put a spare device
  btrfs: introduce helper functions to perform hot replace
  btrfs: introduce device dynamic state transition to offline or failed
  btrfs: check device for critical errors and mark failed
  btrfs: check for failed device and hot replace

Qu Wenruo (5):
  btrfs: Introduce a new function to check if all chunks a OK for
    degraded mount
  btrfs: Do per-chunk check for mount time check
  btrfs: Do per-chunk degraded check for remount
  btrfs: Allow barrier_all_devices to do per-chunk device check
  btrfs: Cleanup num_tolerated_disk_barrier_failures

 fs/btrfs/ctree.h       |  11 +-
 fs/btrfs/dev-replace.c |  43 ++++++++
 fs/btrfs/dev-replace.h |   1 +
 fs/btrfs/disk-io.c     | 230 +++++++++++++++++++++++++++-------------
 fs/btrfs/disk-io.h     |   2 -
 fs/btrfs/super.c       |  16 ++-
 fs/btrfs/volumes.c     | 279 ++++++++++++++++++++++++++++++++++++++++++++++---
 fs/btrfs/volumes.h     |  26 +++++
 8 files changed, 509 insertions(+), 99 deletions(-)


btrfs-progs:

Anand Jain (4):
  btrfs-progs: Introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV SB flags
  btrfs-progs: Introduce btrfs spare subcommand
  btrfs-progs: add fi show for spare
  btrfs-progs: add global spare device list to filesystem show

 Android.mk        |   2 +-
 Makefile.in       |   3 +-
 btrfs.c           |   1 +
 cmds-filesystem.c |   9 ++
 cmds-spare.c      | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 commands.h        |   2 +
 ctree.h           |   4 +-
 utils.h           |   1 +
 volumes.c         |   4 +
 volumes.h         |   2 +
 10 files changed, 317 insertions(+), 3 deletions(-)
 create mode 100644 cmds-spare.c

-- 
2.7.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/13] btrfs: Introduce a new function to check if all chunks a OK for degraded mount
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 02/13] btrfs: Do per-chunk check for mount time check Anand Jain
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

Introduce a new function, btrfs_check_degradable(), to judge if all chunks
in btrfs is OK for degraded mount.

It provides the new basis for accurate btrfs mount/remount and even
runtime degraded mount check other than old one-size-fit-all method.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 fs/btrfs/volumes.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/volumes.h |  1 +
 2 files changed, 64 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e2b54d546b7c..dd3dc53a302a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7042,3 +7042,66 @@ static void btrfs_close_one_device(struct btrfs_device *device)
 
 	call_rcu(&device->rcu, free_device);
 }
+
+/*
+ * Check if all chunks in the fs is OK for degraded mount
+ * Caller itself should do extra check if DEGRADED mount option is given
+ * for >0 return value.
+ *
+ * Return 0 if all chunks are OK.
+ * Return >0 if all chunks are degradable but not all OK.
+ * Return <0 if any chunk is not degradable or other bug.
+ */
+int btrfs_check_degradable(struct btrfs_fs_info *fs_info, unsigned flags)
+{
+	struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
+	struct extent_map *em;
+	u64 next_start = 0;
+	int ret = 0;
+
+	if (flags & MS_RDONLY)
+		return 0;
+
+	read_lock(&map_tree->map_tree.lock);
+	em = lookup_extent_mapping(&map_tree->map_tree, 0, (u64)(-1));
+	/* No any chunk? Should be a huge bug */
+	if (!em) {
+		ret = -ENOENT;
+		goto out;
+	}
+
+	while (em) {
+		struct map_lookup *map;
+		int missing = 0;
+		int max_tolerated;
+		int i;
+
+		map = (struct map_lookup *) em->bdev;
+		max_tolerated =
+			btrfs_get_num_tolerated_disk_barrier_failures(
+					map->type);
+		for (i = 0; i < map->num_stripes; i++) {
+			if (map->stripes[i].dev->missing)
+				missing++;
+		}
+		if (missing > max_tolerated) {
+			ret = -EIO;
+			btrfs_warn(fs_info,
+				   "missing devices(%d) exceeds the limit(%d), writebale mount is not allowed",
+				   missing, max_tolerated);
+			goto out;
+		} else if (missing)
+			ret = 1;
+		next_start = extent_map_end(em);
+
+		/*
+		 * Alwasy search range [next_start, (u64)-1) to find the next
+		 * chunk map
+		 */
+		em = lookup_extent_mapping(&map_tree->map_tree, next_start,
+					   (u64)(-1) - next_start);
+	}
+out:
+	read_unlock(&map_tree->map_tree.lock);
+	return ret;
+}
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 1939ebde63df..351431a3f5aa 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -566,5 +566,6 @@ static inline void unlock_chunks(struct btrfs_root *root)
 struct list_head *btrfs_get_fs_uuids(void);
 void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info);
 void btrfs_reset_fs_info_ptr(struct btrfs_fs_info *fs_info);
+int btrfs_check_degradable(struct btrfs_fs_info *fs_info, unsigned flags);
 
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/13] btrfs: Do per-chunk check for mount time check
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
  2016-04-02  1:30 ` [PATCH 01/13] btrfs: Introduce a new function to check if all chunks a OK for degraded mount Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 03/13] btrfs: Do per-chunk degraded check for remount Anand Jain
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

Now use the btrfs_check_degraded() to do mount time degraded check.

With this patch, now we can mount with the following case:
 # mkfs.btrfs -f -m raid1 -d single /dev/sdb /dev/sdc
 # wipefs -a /dev/sdc
 # mount /dev/sdb /mnt/btrfs -o degraded
 As the single data chunk is only in sdb, so it's OK to mount as degraded,
 as missing one device is OK for RAID1.

But still fail with the following case as expected:
 # mkfs.btrfs -f -m raid1 -d single /dev/sdb /dev/sdc
 # wipefs -a /dev/sdb
 # mount /dev/sdc /mnt/btrfs -o degraded
 As the data chunk is only in sdb, so it's not OK to mount it as degraded.

Reported-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reported-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

[Btrfs: use btrfs_error instead of btrfs_err during mount]
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/disk-io.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c95e3ce9f22e..bfea0f8f6a87 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2880,6 +2880,16 @@ int open_ctree(struct super_block *sb,
 		goto fail_tree_roots;
 	}
 
+	ret = btrfs_check_degradable(fs_info, fs_info->sb->s_flags);
+	if (ret < 0) {
+		btrfs_err(fs_info, "degraded writable mount failed %d", ret);
+		goto fail_tree_roots;
+	} else if (ret > 0 && !btrfs_test_opt(chunk_root, DEGRADED)) {
+		btrfs_warn(fs_info,
+			"Some device missing, but still degraded mountable, please mount with -o degraded option");
+		ret = -EACCES;
+		goto fail_tree_roots;
+	}
 	/*
 	 * keep the device that is marked to be the target device for the
 	 * dev_replace procedure
@@ -2983,14 +2993,6 @@ retry_root_backup:
 	}
 	fs_info->num_tolerated_disk_barrier_failures =
 		btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
-	if (fs_info->fs_devices->missing_devices >
-	     fs_info->num_tolerated_disk_barrier_failures &&
-	    !(sb->s_flags & MS_RDONLY)) {
-		pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n",
-			fs_info->fs_devices->missing_devices,
-			fs_info->num_tolerated_disk_barrier_failures);
-		goto fail_sysfs;
-	}
 
 	fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
 					       "btrfs-cleaner");
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/13] btrfs: Do per-chunk degraded check for remount
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
  2016-04-02  1:30 ` [PATCH 01/13] btrfs: Introduce a new function to check if all chunks a OK for degraded mount Anand Jain
  2016-04-02  1:30 ` [PATCH 02/13] btrfs: Do per-chunk check for mount time check Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 04/13] btrfs: Allow barrier_all_devices to do per-chunk device check Anand Jain
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

Just the same for mount time check, use new btrfs_check_degraded() to do
per chunk check.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Btrfs: use btrfs_error instead of btrfs_err during remount

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/super.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 00b8f37cc306..87639fa53b10 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1767,11 +1767,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 			goto restore;
 		}
 
-		if (fs_info->fs_devices->missing_devices >
-		     fs_info->num_tolerated_disk_barrier_failures &&
-		    !(*flags & MS_RDONLY)) {
+		ret = btrfs_check_degradable(fs_info, *flags);
+		if (ret < 0) {
+			btrfs_err(fs_info,
+				"degraded writable remount failed %d", ret);
+			goto restore;
+		} else if (ret > 0 && !btrfs_test_opt(root, DEGRADED)) {
 			btrfs_warn(fs_info,
-				"too many missing devices, writeable remount is not allowed");
+				"some device missing, but still degraded mountable, please remount with -o degraded option");
 			ret = -EACCES;
 			goto restore;
 		}
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/13] btrfs: Allow barrier_all_devices to do per-chunk device check
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (2 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 03/13] btrfs: Do per-chunk degraded check for remount Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 05/13] btrfs: Cleanup num_tolerated_disk_barrier_failures Anand Jain
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

The last user of num_tolerated_disk_barrier_failures is
barrier_all_devices(). But it's can be easily changed to new per-chunk
degradable check framework.

Now btrfs_device will have two extra members, representing send/wait
error, set at write_dev_flush() time. And then check it in a similar but
more accurate behavior than old code.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 fs/btrfs/disk-io.c | 13 +++++--------
 fs/btrfs/volumes.c |  6 +++++-
 fs/btrfs/volumes.h |  4 ++++
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bfea0f8f6a87..85e26d62c089 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3491,8 +3491,6 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 {
 	struct list_head *head;
 	struct btrfs_device *dev;
-	int errors_send = 0;
-	int errors_wait = 0;
 	int ret;
 
 	/* send down all the barriers */
@@ -3501,7 +3499,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 		if (dev->missing)
 			continue;
 		if (!dev->bdev) {
-			errors_send++;
+			dev->err_send = 1;
 			continue;
 		}
 		if (!dev->in_fs_metadata || !dev->writeable)
@@ -3509,7 +3507,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 
 		ret = write_dev_flush(dev, 0);
 		if (ret)
-			errors_send++;
+			dev->err_send = 1;
 	}
 
 	/* wait for all the barriers */
@@ -3517,7 +3515,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 		if (dev->missing)
 			continue;
 		if (!dev->bdev) {
-			errors_wait++;
+			dev->err_wait = 1;
 			continue;
 		}
 		if (!dev->in_fs_metadata || !dev->writeable)
@@ -3525,10 +3523,9 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 
 		ret = write_dev_flush(dev, 1);
 		if (ret)
-			errors_wait++;
+			dev->err_wait = 1;
 	}
-	if (errors_send > info->num_tolerated_disk_barrier_failures ||
-	    errors_wait > info->num_tolerated_disk_barrier_failures)
+	if (btrfs_check_degradable(info, info->sb->s_flags) < 0)
 		return -EIO;
 	return 0;
 }
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index dd3dc53a302a..a840d78ba127 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7081,8 +7081,12 @@ int btrfs_check_degradable(struct btrfs_fs_info *fs_info, unsigned flags)
 			btrfs_get_num_tolerated_disk_barrier_failures(
 					map->type);
 		for (i = 0; i < map->num_stripes; i++) {
-			if (map->stripes[i].dev->missing)
+			if (map->stripes[i].dev->missing ||
+			    map->stripes[i].dev->err_wait ||
+			    map->stripes[i].dev->err_send)
 				missing++;
+			map->stripes[i].dev->err_wait = 0;
+			map->stripes[i].dev->err_send = 0;
 		}
 		if (missing > max_tolerated) {
 			ret = -EIO;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 351431a3f5aa..48ced5cc09e4 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -76,6 +76,10 @@ struct btrfs_device {
 	int can_discard;
 	int is_tgtdev_for_dev_replace;
 
+	/* for barrier_all_devices() check */
+	int err_send;
+	int err_wait;
+
 #ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
 	seqcount_t data_seqcount;
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/13] btrfs: Cleanup num_tolerated_disk_barrier_failures
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (3 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 04/13] btrfs: Allow barrier_all_devices to do per-chunk device check Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 06/13] btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV Anand Jain
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

As we use per-chunk degradable check, now the global
num_tolerated_disk_barrier_failures is of no use. So cleanup it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

[Btrfs: resolve conflict to apply 'btrfs: Cleanup num_tolerated_disk_barrier_failures']
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/ctree.h   |  2 --
 fs/btrfs/disk-io.c | 56 ------------------------------------------------------
 fs/btrfs/disk-io.h |  2 --
 fs/btrfs/volumes.c | 17 -----------------
 4 files changed, 77 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 84a6a5b3384a..e0a50f478e01 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1829,8 +1829,6 @@ struct btrfs_fs_info {
 	/* next backup root to be overwritten */
 	int backup_root_index;
 
-	int num_tolerated_disk_barrier_failures;
-
 	/* device replace state */
 	struct btrfs_dev_replace dev_replace;
 
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 85e26d62c089..7f02f1766037 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2991,8 +2991,6 @@ retry_root_backup:
 		printk(KERN_ERR "BTRFS: Failed to read block groups: %d\n", ret);
 		goto fail_sysfs;
 	}
-	fs_info->num_tolerated_disk_barrier_failures =
-		btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
 
 	fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
 					       "btrfs-cleaner");
@@ -3559,60 +3557,6 @@ int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags)
 	return min_tolerated;
 }
 
-int btrfs_calc_num_tolerated_disk_barrier_failures(
-	struct btrfs_fs_info *fs_info)
-{
-	struct btrfs_ioctl_space_info space;
-	struct btrfs_space_info *sinfo;
-	u64 types[] = {BTRFS_BLOCK_GROUP_DATA,
-		       BTRFS_BLOCK_GROUP_SYSTEM,
-		       BTRFS_BLOCK_GROUP_METADATA,
-		       BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA};
-	int i;
-	int c;
-	int num_tolerated_disk_barrier_failures =
-		(int)fs_info->fs_devices->num_devices;
-
-	for (i = 0; i < ARRAY_SIZE(types); i++) {
-		struct btrfs_space_info *tmp;
-
-		sinfo = NULL;
-		rcu_read_lock();
-		list_for_each_entry_rcu(tmp, &fs_info->space_info, list) {
-			if (tmp->flags == types[i]) {
-				sinfo = tmp;
-				break;
-			}
-		}
-		rcu_read_unlock();
-
-		if (!sinfo)
-			continue;
-
-		down_read(&sinfo->groups_sem);
-		for (c = 0; c < BTRFS_NR_RAID_TYPES; c++) {
-			u64 flags;
-
-			if (list_empty(&sinfo->block_groups[c]))
-				continue;
-
-			btrfs_get_block_group_info(&sinfo->block_groups[c],
-						   &space);
-			if (space.total_bytes == 0 || space.used_bytes == 0)
-				continue;
-			flags = space.flags;
-
-			num_tolerated_disk_barrier_failures = min(
-				num_tolerated_disk_barrier_failures,
-				btrfs_get_num_tolerated_disk_barrier_failures(
-					flags));
-		}
-		up_read(&sinfo->groups_sem);
-	}
-
-	return num_tolerated_disk_barrier_failures;
-}
-
 static int write_all_supers(struct btrfs_root *root, int max_mirrors)
 {
 	struct list_head *head;
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 8e79d0070bcf..dd155621f95f 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -141,8 +141,6 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 int btree_lock_page_hook(struct page *page, void *data,
 				void (*flush_fn)(void *));
 int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
-int btrfs_calc_num_tolerated_disk_barrier_failures(
-	struct btrfs_fs_info *fs_info);
 int __init btrfs_end_io_wq_init(void);
 void btrfs_end_io_wq_exit(void);
 
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a840d78ba127..dff2deaf88d3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1876,9 +1876,6 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 		free_fs_devices(cur_devices);
 	}
 
-	root->fs_info->num_tolerated_disk_barrier_failures =
-		btrfs_calc_num_tolerated_disk_barrier_failures(root->fs_info);
-
 	/*
 	 * at this point, the device is zero sized.  We want to
 	 * remove it from the devices list and zero out the old super
@@ -2405,8 +2402,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
 				"sysfs: failed to create fsid for sprout");
 	}
 
-	root->fs_info->num_tolerated_disk_barrier_failures =
-		btrfs_calc_num_tolerated_disk_barrier_failures(root->fs_info);
 	ret = btrfs_commit_transaction(trans, root);
 
 	if (seeding_dev) {
@@ -3757,13 +3752,6 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
 			bctl->meta.target, bctl->data.target);
 	}
 
-	if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) {
-		fs_info->num_tolerated_disk_barrier_failures = min(
-			btrfs_calc_num_tolerated_disk_barrier_failures(fs_info),
-			btrfs_get_num_tolerated_disk_barrier_failures(
-				bctl->sys.target));
-	}
-
 	ret = insert_balance_item(fs_info->tree_root, bctl);
 	if (ret && ret != -EEXIST)
 		goto out;
@@ -3786,11 +3774,6 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
 	mutex_lock(&fs_info->balance_mutex);
 	atomic_dec(&fs_info->balance_running);
 
-	if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) {
-		fs_info->num_tolerated_disk_barrier_failures =
-			btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
-	}
-
 	if (bargs) {
 		memset(bargs, 0, sizeof(*bargs));
 		update_ioctl_balance_args(fs_info, 0, bargs);
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/13] btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (4 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 05/13] btrfs: Cleanup num_tolerated_disk_barrier_failures Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 07/13] btrfs: add check not to mount a spare device Anand Jain
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

Add BTRFS_FEATURE_INCOMPAT_SPARE_DEV (400) flag to identify
a spare device.

Along with this it checks in the mount context that a spare
device will fail to mount.  As spare devices aren't mountable.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/ctree.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e0a50f478e01..2c185a8e92f0 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -531,6 +531,7 @@ struct btrfs_super_block {
 #define BTRFS_FEATURE_INCOMPAT_RAID56		(1ULL << 7)
 #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA	(1ULL << 8)
 #define BTRFS_FEATURE_INCOMPAT_NO_HOLES		(1ULL << 9)
+#define BTRFS_FEATURE_INCOMPAT_SPARE_DEV	(1ULL << 10)
 
 #define BTRFS_FEATURE_COMPAT_SUPP		0ULL
 #define BTRFS_FEATURE_COMPAT_SAFE_SET		0ULL
@@ -551,7 +552,8 @@ struct btrfs_super_block {
 	 BTRFS_FEATURE_INCOMPAT_RAID56 |		\
 	 BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF |		\
 	 BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA |	\
-	 BTRFS_FEATURE_INCOMPAT_NO_HOLES)
+	 BTRFS_FEATURE_INCOMPAT_NO_HOLES |		\
+	 BTRFS_FEATURE_INCOMPAT_SPARE_DEV)
 
 #define BTRFS_FEATURE_INCOMPAT_SAFE_SET			\
 	(BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/13] btrfs: add check not to mount a spare device
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (5 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 06/13] btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 08/13] btrfs: support btrfs dev scan for " Anand Jain
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

Spare devices can be scanned but shouldn't be mountable.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/disk-io.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 7f02f1766037..b99329e37965 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2806,6 +2806,14 @@ int open_ctree(struct super_block *sb,
 		goto fail_alloc;
 	}
 
+	if (btrfs_super_incompat_flags(disk_super) &
+			BTRFS_FEATURE_INCOMPAT_SPARE_DEV) {
+		/*You can only scan a spare device but not mount*/
+		printk(KERN_ERR "BTRFS: You can't mount a spare device\n");
+		err = -ENOTSUPP;
+		goto fail_alloc;
+	}
+
 	/*
 	 * Needn't use the lock because there is no other task which will
 	 * update the flag.
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/13] btrfs: support btrfs dev scan for spare device
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (6 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 07/13] btrfs: add check not to mount a spare device Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 09/13] btrfs: provide framework to get and put a " Anand Jain
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

When the user or system calls the BTRFS_IOC_SCAN_DEV,
ioctl this patch will make sure it is added to the device
list and set it as spare.

This operation will be same when BTRFS_IOC_DEVICES_READY
as well since BTRFS_IOC_DEVICES_READY ioctl has been doing
that by legacy.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/volumes.c | 4 ++++
 fs/btrfs/volumes.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index dff2deaf88d3..d729539f9612 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -604,6 +604,10 @@ static noinline int device_list_add(const char *path,
 		if (IS_ERR(fs_devices))
 			return PTR_ERR(fs_devices);
 
+		if (btrfs_super_incompat_flags(disk_super) &
+				BTRFS_FEATURE_INCOMPAT_SPARE_DEV)
+			fs_devices->spare = 1;
+
 		list_add(&fs_devices->list, &fs_uuids);
 
 		device = NULL;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 48ced5cc09e4..51cf716eb35b 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -263,6 +263,8 @@ struct btrfs_fs_devices {
 	struct kobject fsid_kobj;
 	struct kobject *device_dir_kobj;
 	struct completion kobj_unregister;
+
+	int spare;
 };
 
 #define BTRFS_BIO_INLINE_CSUM_SIZE	64
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/13] btrfs: provide framework to get and put a spare device
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (7 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 08/13] btrfs: support btrfs dev scan for " Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

This adds functions to get and put a spare device from the list.
So that hot repace code can pick a spare device when needed.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/ctree.h   |  1 +
 fs/btrfs/super.c   |  5 +++++
 fs/btrfs/volumes.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/volumes.h |  2 ++
 4 files changed, 61 insertions(+)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2c185a8e92f0..aa693cfdc9f0 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -4185,6 +4185,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
 ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
 
 /* super.c */
+struct file_system_type *btrfs_get_fs_type(void);
 int btrfs_parse_options(struct btrfs_root *root, char *options,
 			unsigned long new_flags);
 int btrfs_sync_fs(struct super_block *sb, int wait);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 87639fa53b10..49ba899b2d36 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -69,6 +69,11 @@ static struct file_system_type btrfs_fs_type;
 
 static int btrfs_remount(struct super_block *sb, int *flags, char *data);
 
+struct file_system_type *btrfs_get_fs_type()
+{
+	return &btrfs_fs_type;
+}
+
 const char *btrfs_decode_error(int errno)
 {
 	char *errstr = "unknown";
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d729539f9612..072cefac958c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -525,6 +525,59 @@ static void pending_bios_fn(struct btrfs_work *work)
 	run_scheduled_bios(device);
 }
 
+int btrfs_get_spare_device(char **path)
+{
+	int ret = 1;
+	struct btrfs_fs_devices *fs_devices;
+	struct btrfs_device *device;
+	struct list_head *fs_uuids = btrfs_get_fs_uuids();
+
+	mutex_lock(&uuid_mutex);
+	list_for_each_entry(fs_devices, fs_uuids, list) {
+		if (!fs_devices->spare)
+			continue;
+
+		/* as of now there is only one device in the spare fs_devices */
+		device = list_entry(fs_devices->devices.next,
+					struct btrfs_device, dev_list);
+
+		if (!device || !device->name)
+			continue;
+
+		fs_devices->spare = 0;
+		/*
+		 * Its under uuid_mutex and there is one spare per fsid
+		 * so rcu lock is actually not required
+		 */
+		*path = kstrdup(device->name->str, GFP_KERNEL);
+		if (*path)
+			ret = 0;
+		else
+			ret = -ENOMEM;
+		break;
+	}
+
+	if (!ret) {
+		btrfs_sysfs_remove_fsid(fs_devices);
+		list_del(&fs_devices->list);
+		free_fs_devices(fs_devices);
+	}
+	mutex_unlock(&uuid_mutex);
+
+	return ret;
+}
+
+void btrfs_put_spare_device(char *path)
+{
+	struct file_system_type *btrfs_fs_type;
+	struct btrfs_fs_devices *fs_devices;
+
+	btrfs_fs_type = btrfs_get_fs_type();
+
+	if (btrfs_scan_one_device(path, FMODE_READ,
+				    btrfs_fs_type, &fs_devices))
+		printk(KERN_INFO "failed to return spare device\n");
+}
 
 void btrfs_free_stale_device(struct btrfs_device *cur_dev)
 {
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 51cf716eb35b..b4308afa3097 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -469,6 +469,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *path);
 int btrfs_init_dev_replace_tgtdev(struct btrfs_root *root, char *device_path,
 				  struct btrfs_device *srcdev,
 				  struct btrfs_device **device_out);
+int btrfs_get_spare_device(char **path);
+void btrfs_put_spare_device(char *path);
 int btrfs_balance(struct btrfs_balance_control *bctl,
 		  struct btrfs_ioctl_balance_args *bargs);
 int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info);
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (8 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 09/13] btrfs: provide framework to get and put a " Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  5:40   ` kbuild test robot
                     ` (2 more replies)
  2016-04-02  1:30 ` [PATCH 11/13] btrfs: introduce device dynamic state transition to offline or failed Anand Jain
                   ` (3 subsequent siblings)
  13 siblings, 3 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

Hot replace / auto replace is important volume manager feature
and is critical to the data center operations, so that the degraded
volume can be brought back to a healthy state at the earliest and
without manual intervention.

This modifies the existing replace code to suite the need of auto
replace, in the long run I hope both the codes to be merged.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/dev-replace.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 2b926867d136..ceab4c51db32 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
 				     &fs_info->fs_state));
 	}
 }
+
+int btrfs_auto_replace_start(struct btrfs_root *root,
+				struct btrfs_device *src_device)
+{
+	int ret;
+	char *tgt_path;
+	char *src_path;
+	struct btrfs_fs_info *fs_info = root->fs_info;
+
+	if (fs_info->sb->s_flags & MS_RDONLY)
+		return -EROFS;
+
+	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
+	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
+		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		return -EBUSY;
+	}
+	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+
+	if (btrfs_get_spare_device(&tgt_path)) {
+		btrfs_err(root->fs_info,
+			"No spare device found/configured in the kernel");
+		return -EINVAL;
+	}
+
+	rcu_read_lock();
+	src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
+	rcu_read_unlock();
+	if (!src_path) {
+		kfree(tgt_path);
+		return -ENOMEM;
+	}
+	ret = btrfs_dev_replace_start(root, tgt_path,
+					src_device->devid, src_path,
+		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
+	if (ret)
+		btrfs_put_spare_device(tgt_path);
+
+	kfree(tgt_path);
+	kfree(src_path);
+
+	return 0;
+}
diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
index e922b42d91df..b918b9d6e5df 100644
--- a/fs/btrfs/dev-replace.h
+++ b/fs/btrfs/dev-replace.h
@@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
 {
 	atomic64_inc(stat_value);
 }
+int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/13] btrfs: introduce device dynamic state transition to offline or failed
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (9 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 12/13] btrfs: check device for critical errors and mark failed Anand Jain
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

This patch provides helper functions to force a device to offline
or failed, and we need this device states for the following reasons,
1) a. it can be reported that device has failed when it does
   b. close the device when it goes offline so that blocklayer can
      cleanup
2) identify the candidate for the auto replace
3) avoid further commit error reported against the failing device and
4) a device in the multi device btrfs may go offline from the system
   (but as of now in in some system config btrfs gets unmounted in this
    context, which is not a correct behavior)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/volumes.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/volumes.h |  13 +++++
 2 files changed, 150 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 072cefac958c..eb9f28504d3f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7149,3 +7149,140 @@ out:
 	read_unlock(&map_tree->map_tree.lock);
 	return ret;
 }
+
+static void __close_device(struct work_struct *work)
+{
+	struct btrfs_device *device;
+
+	device = container_of(work, struct btrfs_device, rcu_work);
+
+	if (device->bdev)
+		blkdev_put(device->bdev, device->mode);
+
+	device->bdev = NULL;
+}
+
+static void close_device(struct rcu_head *head)
+{
+	struct btrfs_device *device;
+
+	device = container_of(head, struct btrfs_device, rcu);
+
+	INIT_WORK(&device->rcu_work, __close_device);
+	schedule_work(&device->rcu_work);
+}
+
+void btrfs_close_one_device_dont_free(struct btrfs_device *device)
+{
+	struct btrfs_fs_devices *fs_devices = device->fs_devices;
+
+	if (device->bdev)
+		fs_devices->open_devices--;
+
+	if (device->writeable &&
+	    device->devid != BTRFS_DEV_REPLACE_DEVID) {
+		list_del_init(&device->dev_alloc_list);
+		fs_devices->rw_devices--;
+	}
+
+	device->writeable = 0;
+
+	call_rcu(&device->rcu, close_device);
+}
+
+void force_device_close(struct btrfs_device *device)
+{
+	struct btrfs_device *next_device;
+	struct btrfs_fs_devices *fs_devices;
+
+	fs_devices = device->fs_devices;
+
+	mutex_lock(&fs_devices->device_list_mutex);
+	lock_chunks(fs_devices->fs_info->fs_root);
+
+	next_device = list_entry(fs_devices->devices.next,
+					struct btrfs_device, dev_list);
+	if (device->bdev == fs_devices->fs_info->sb->s_bdev)
+		fs_devices->fs_info->sb->s_bdev = next_device->bdev;
+
+	if (device->bdev == fs_devices->latest_bdev)
+		fs_devices->latest_bdev = next_device->bdev;
+
+	btrfs_close_one_device_dont_free(device);
+
+	/*
+	 * TODO: works for now, but its better to keep the state of
+	 * missing and offline different, and update rest of the
+	 * places where we check for only missing and not for failed
+	 * or offline as of now.
+	 */
+	device->missing = 1;
+	fs_devices->missing_devices++;
+	device->writeable = 0;
+
+	rcu_barrier();
+
+	unlock_chunks(fs_devices->fs_info->fs_root);
+	mutex_unlock(&fs_devices->device_list_mutex);
+}
+
+void btrfs_enforce_device_state(struct btrfs_device *dev, char *why)
+{
+	bool degrade_option;
+	int tolerated_fail;
+	struct btrfs_fs_info *fs_info;
+	struct btrfs_fs_devices *fs_devices;
+
+	fs_devices = dev->fs_devices;
+	fs_info = fs_devices->fs_info;
+	degrade_option = btrfs_test_opt(fs_info->fs_root, DEGRADED);
+
+	/* todo: support seed later */
+	if (fs_devices->seeding)
+		return;
+
+	/* this shouldn't be called if device is already missing */
+	if (dev->missing || !dev->bdev)
+		return;
+
+	if (dev->offline || dev->failed)
+		return;
+
+	/* Only RW device is requested to force close let FS handle it*/
+	if (fs_devices->rw_devices == 1) {
+		btrfs_std_error(fs_info, -EIO,
+			"force offline last RW device");
+		return;
+	}
+
+	if (!strcmp(why, "offline"))
+		dev->offline = 1;
+	else if (!strcmp(why, "failed"))
+		dev->failed = 1;
+	else
+		return;
+
+	btrfs_sysfs_rm_device_link(fs_devices, dev);
+
+	force_device_close(dev);
+
+	tolerated_fail = btrfs_check_degradable(fs_info,
+						fs_info->sb->s_flags);
+	if (tolerated_fail > 0) {
+		btrfs_warn_in_rcu(fs_info, "device %s %s, chunks degraded",
+					rcu_str_deref(dev->name), why);
+	} else if(tolerated_fail < 0) {
+		btrfs_warn_in_rcu(fs_info,
+		"device %s %s, chunks failed",
+			rcu_str_deref(dev->name), why);
+		btrfs_std_error(fs_info, -EIO, "devices below critical level");
+	} else {
+		btrfs_warn_in_rcu(fs_info,
+			"device %s %s, No chunks are degraded",
+			rcu_str_deref(dev->name), why);
+	}
+	btrfs_info_in_rcu(fs_info,
+		"num_devices %llu rw_devices %llu degraded-option: %s",
+		fs_devices->num_devices, fs_devices->rw_devices,
+		degrade_option ? "set":"unset");
+}
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index b4308afa3097..da7d3b8ba50e 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -72,7 +72,19 @@ struct btrfs_device {
 
 	int writeable;
 	int in_fs_metadata;
+	/* missing: device wasn't found at the time of mount */
 	int missing;
+	/* failed: device confirmed to have experienced critical io failure */
+	int failed;
+	/*
+	 * offline: system or user or block layer transport has removed
+	 * offlined the device which was once present and without going
+	 * through unmount. Implies an intriem communication break down
+	 * and not necessarily a candidate for the device replace. And
+	 * device might be online after user intervention or after
+	 * block transport layer error recovery.
+	 */
+	int offline;
 	int can_discard;
 	int is_tgtdev_for_dev_replace;
 
@@ -575,5 +587,6 @@ struct list_head *btrfs_get_fs_uuids(void);
 void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info);
 void btrfs_reset_fs_info_ptr(struct btrfs_fs_info *fs_info);
 int btrfs_check_degradable(struct btrfs_fs_info *fs_info, unsigned flags);
+void btrfs_enforce_device_state(struct btrfs_device *dev, char *why);
 
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/13] btrfs: check device for critical errors and mark failed
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (10 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 11/13] btrfs: introduce device dynamic state transition to offline or failed Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-02  1:30 ` [PATCH 13/13] btrfs: check for failed device and hot replace Anand Jain
  2016-04-04  0:00 ` [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Kai Krakow
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

Write and Flush errors are considered as critical errors,
upon which the device will be brought offline and marked as
failed. Write and Flush errors are identified using device
error statistics. This is monitored using a kthread
btrfs_health.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/ctree.h   |   2 ++
 fs/btrfs/disk-io.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 fs/btrfs/volumes.c |   1 +
 fs/btrfs/volumes.h |   4 +++
 4 files changed, 107 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index aa693cfdc9f0..47e9cd9dd29a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1569,6 +1569,7 @@ struct btrfs_fs_info {
 	struct mutex tree_log_mutex;
 	struct mutex transaction_kthread_mutex;
 	struct mutex cleaner_mutex;
+	struct mutex health_mutex;
 	struct mutex chunk_mutex;
 	struct mutex volume_mutex;
 
@@ -1686,6 +1687,7 @@ struct btrfs_fs_info {
 	struct btrfs_workqueue *extent_workers;
 	struct task_struct *transaction_kthread;
 	struct task_struct *cleaner_kthread;
+	struct task_struct *health_kthread;
 	int thread_pool_size;
 
 	struct kobject *space_info_kobj;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b99329e37965..b523e56b34e9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1869,6 +1869,93 @@ sleep:
 	return 0;
 }
 
+/*
+ * returns:
+ * < 0 : Check didn't run, std error
+ *   0 : No errors found
+ * > 0 : # of devices having fatal errors
+ */
+static int btrfs_update_devices_health(struct btrfs_root *root)
+{
+	int ret = 0;
+	struct btrfs_device *device;
+	struct btrfs_fs_info *fs_info = root->fs_info;
+
+	if (btrfs_fs_closing(fs_info))
+		return -EBUSY;
+
+	/* mark disk(s) with write or flush error(s) as failed */
+	mutex_lock(&fs_info->volume_mutex);
+	list_for_each_entry_rcu(device,
+			&fs_info->fs_devices->devices, dev_list) {
+		int c_err;
+
+		if (device->failed) {
+			ret++;
+			continue;
+		}
+
+		/*
+		 * todo: replace target device's write/flush error,
+		 * skip for now
+		 */
+		if (device->is_tgtdev_for_dev_replace)
+			continue;
+
+		if (!device->dev_stats_valid)
+			continue;
+
+		c_err = atomic_read(&device->new_critical_errs);
+		atomic_sub(c_err, &device->new_critical_errs);
+		if (c_err) {
+			btrfs_crit_in_rcu(fs_info,
+				"fatal error on device %s",
+					rcu_str_deref(device->name));
+			btrfs_enforce_device_state(device, "failed");
+			ret ++;
+		}
+	}
+	mutex_unlock(&fs_info->volume_mutex);
+
+	return ret;
+}
+
+/*
+ * Devices health maintenance kthread, gets woken-up by transaction
+ * kthread, once sysfs is ready, this should publish the report
+ * through sysfs so that user land scripts and invoke actions.
+ */
+static int health_kthread(void *arg)
+{
+	struct btrfs_root *root = arg;
+
+	do {
+		if (btrfs_need_cleaner_sleep(root))
+			goto sleep;
+
+		if (!mutex_trylock(&root->fs_info->health_mutex))
+			goto sleep;
+
+		if (btrfs_need_cleaner_sleep(root)) {
+			mutex_unlock(&root->fs_info->health_mutex);
+			goto sleep;
+		}
+
+		/* Check devices health */
+		btrfs_update_devices_health(root);
+
+		mutex_unlock(&root->fs_info->health_mutex);
+
+sleep:
+		set_current_state(TASK_INTERRUPTIBLE);
+		if (!kthread_should_stop())
+			schedule();
+		__set_current_state(TASK_RUNNING);
+	} while (!kthread_should_stop());
+
+	return 0;
+}
+
 static int transaction_kthread(void *arg)
 {
 	struct btrfs_root *root = arg;
@@ -1915,6 +2002,7 @@ static int transaction_kthread(void *arg)
 			btrfs_end_transaction(trans, root);
 		}
 sleep:
+		wake_up_process(root->fs_info->health_kthread);
 		wake_up_process(root->fs_info->cleaner_kthread);
 		mutex_unlock(&root->fs_info->transaction_kthread_mutex);
 
@@ -2663,6 +2751,7 @@ int open_ctree(struct super_block *sb,
 	mutex_init(&fs_info->chunk_mutex);
 	mutex_init(&fs_info->transaction_kthread_mutex);
 	mutex_init(&fs_info->cleaner_mutex);
+	mutex_init(&fs_info->health_mutex);
 	mutex_init(&fs_info->volume_mutex);
 	mutex_init(&fs_info->ro_block_group_mutex);
 	init_rwsem(&fs_info->commit_root_sem);
@@ -3005,11 +3094,16 @@ retry_root_backup:
 	if (IS_ERR(fs_info->cleaner_kthread))
 		goto fail_sysfs;
 
+	fs_info->health_kthread = kthread_run(health_kthread, tree_root,
+					       "btrfs-health");
+	if (IS_ERR(fs_info->health_kthread))
+		goto fail_cleaner;
+
 	fs_info->transaction_kthread = kthread_run(transaction_kthread,
 						   tree_root,
 						   "btrfs-transaction");
 	if (IS_ERR(fs_info->transaction_kthread))
-		goto fail_cleaner;
+		goto fail_health;
 
 	if (!btrfs_test_opt(tree_root, SSD) &&
 	    !btrfs_test_opt(tree_root, NOSSD) &&
@@ -3173,6 +3267,10 @@ fail_trans_kthread:
 	kthread_stop(fs_info->transaction_kthread);
 	btrfs_cleanup_transaction(fs_info->tree_root);
 	btrfs_free_fs_roots(fs_info);
+
+fail_health:
+	kthread_stop(fs_info->health_kthread);
+
 fail_cleaner:
 	kthread_stop(fs_info->cleaner_kthread);
 
@@ -3828,6 +3926,7 @@ void close_ctree(struct btrfs_root *root)
 
 	kthread_stop(fs_info->transaction_kthread);
 	kthread_stop(fs_info->cleaner_kthread);
+	kthread_stop(fs_info->health_kthread);
 
 	fs_info->closing = 2;
 	smp_mb();
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index eb9f28504d3f..bb9909a2586a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -233,6 +233,7 @@ static struct btrfs_device *__alloc_device(void)
 	spin_lock_init(&dev->reada_lock);
 	atomic_set(&dev->reada_in_flight, 0);
 	atomic_set(&dev->dev_stats_ccnt, 0);
+	atomic_set(&dev->new_critical_errs, 0);
 	btrfs_device_data_ordered_init(dev);
 	INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
 	INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index da7d3b8ba50e..18c01739d46b 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -166,6 +166,7 @@ struct btrfs_device {
 	/* Counter to record the change of device stats */
 	atomic_t dev_stats_ccnt;
 	atomic_t dev_stat_values[BTRFS_DEV_STAT_VALUES_MAX];
+	atomic_t new_critical_errs;
 };
 
 /*
@@ -536,6 +537,9 @@ static inline void btrfs_dev_stat_inc(struct btrfs_device *dev,
 	atomic_inc(dev->dev_stat_values + index);
 	smp_mb__before_atomic();
 	atomic_inc(&dev->dev_stats_ccnt);
+	if (index == BTRFS_DEV_STAT_WRITE_ERRS ||
+		index == BTRFS_DEV_STAT_FLUSH_ERRS)
+		atomic_inc(&dev->new_critical_errs);
 }
 
 static inline int btrfs_dev_stat_read(struct btrfs_device *dev,
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 13/13] btrfs: check for failed device and hot replace
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (11 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 12/13] btrfs: check device for critical errors and mark failed Anand Jain
@ 2016-04-02  1:30 ` Anand Jain
  2016-04-04  0:00 ` [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Kai Krakow
  13 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-02  1:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yauhen.kharuzhy, dsterba

This patch checks for failed device and kicks out auto
replace, if when user decided to disable auto replace
it can be done by future sysfs or future ioctl interface
to set fs_info->no_auto_replace parameter to 1.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/ctree.h   |  2 ++
 fs/btrfs/disk-io.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 47e9cd9dd29a..67bb36bb82ee 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1862,6 +1862,8 @@ struct btrfs_fs_info {
 	struct list_head pinned_chunks;
 
 	int creating_free_space_tree;
+
+	int no_auto_replace;
 };
 
 struct btrfs_subvolume_writers {
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b523e56b34e9..f205e7e94948 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1869,6 +1869,38 @@ sleep:
 	return 0;
 }
 
+static int btrfs_recuperate(struct btrfs_root *root)
+{
+	int ret;
+	int found = 0;
+	struct btrfs_device *device;
+	struct btrfs_fs_devices *fs_devices;
+
+	fs_devices = root->fs_info->fs_devices;
+
+	mutex_lock(&fs_devices->device_list_mutex);
+	rcu_read_lock();
+	list_for_each_entry_rcu(device,
+			&fs_devices->devices, dev_list) {
+		if (device->failed) {
+			found = 1;
+			break;
+		}
+	}
+	rcu_read_unlock();
+	mutex_unlock(&fs_devices->device_list_mutex);
+
+	/*
+	 * We are using the replace code which should be interrupt-able
+	 * during unmount, and as of now there is no user land stop
+	 * request that we support and this will run until its complete
+	 */
+	if (found && !root->fs_info->no_auto_replace)
+		ret = btrfs_auto_replace_start(root, device);
+
+	return ret;
+}
+
 /*
  * returns:
  * < 0 : Check didn't run, std error
@@ -1944,6 +1976,8 @@ static int health_kthread(void *arg)
 		/* Check devices health */
 		btrfs_update_devices_health(root);
 
+		btrfs_recuperate(root);
+
 		mutex_unlock(&root->fs_info->health_mutex);
 
 sleep:
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
@ 2016-04-02  5:40   ` kbuild test robot
  2016-04-07 20:00   ` Yauhen Kharuzhy
  2016-04-08 22:05   ` Yauhen Kharuzhy
  2 siblings, 0 replies; 30+ messages in thread
From: kbuild test robot @ 2016-04-02  5:40 UTC (permalink / raw)
  To: Anand Jain; +Cc: kbuild-all, linux-btrfs, yauhen.kharuzhy, dsterba

[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]

Hi Anand,

[auto build test ERROR on btrfs/next]
[also build test ERROR on v4.6-rc1 next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Anand-Jain/Introduce-device-state-failed-Hot-spare-and-Auto-replace/20160402-093528
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next
config: x86_64-rhel (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/btrfs/dev-replace.c: In function 'btrfs_auto_replace_start':
   fs/btrfs/dev-replace.c:981:38: warning: passing argument 2 of 'btrfs_dev_replace_start' from incompatible pointer type
     ret = btrfs_dev_replace_start(root, tgt_path,
                                         ^
   fs/btrfs/dev-replace.c:308:5: note: expected 'struct btrfs_ioctl_dev_replace_args *' but argument is of type 'char *'
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^
>> fs/btrfs/dev-replace.c:981:8: error: too many arguments to function 'btrfs_dev_replace_start'
     ret = btrfs_dev_replace_start(root, tgt_path,
           ^
   fs/btrfs/dev-replace.c:308:5: note: declared here
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^

vim +/btrfs_dev_replace_start +981 fs/btrfs/dev-replace.c

   975		src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
   976		rcu_read_unlock();
   977		if (!src_path) {
   978			kfree(tgt_path);
   979			return -ENOMEM;
   980		}
 > 981		ret = btrfs_dev_replace_start(root, tgt_path,
   982						src_device->devid, src_path,
   983			BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
   984		if (ret)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 36091 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
                   ` (12 preceding siblings ...)
  2016-04-02  1:30 ` [PATCH 13/13] btrfs: check for failed device and hot replace Anand Jain
@ 2016-04-04  0:00 ` Kai Krakow
  2016-04-04  4:45   ` Duncan
  2016-04-04  6:19   ` Anand Jain
  13 siblings, 2 replies; 30+ messages in thread
From: Kai Krakow @ 2016-04-04  0:00 UTC (permalink / raw)
  To: linux-btrfs

Am Sat,  2 Apr 2016 09:30:38 +0800
schrieb Anand Jain <anand.jain@oracle.com>:

> Auto replace:
>  Replace happens automatically, that is when there is any write
>  failed or flush failed, the device will be marked as failed, which
>  will stop any further IO attempt to that device. And in the next
>  commit cycle the auto replace will pick the spare device to
>  replace the failed device. And so the btrfs volume is back to a
>  healthy state.

Does this also implement "copy-back" - thus, it returns the hot-spare
device to global hot-spares when the failed device has been replaced?

Traditionally, the wording "hot spare" implies that the storage
system runs a copy-back operation when the failing device has been
replaced. The "hot spare" device then returns to its original "hot
spare" function: sitting and waiting to jump in place...

This also helps to keep your drives order in your storage enclosure.
Without copy-back, the association between member drive and storage
enclosure would fluctuate over time and you'd have to constantly update
documentation. Add many identical systems, and you have a lot of
different system configurations over time with individual
documentation. This becomes confusing at best, and turns out
dangerously probably (when pulling the wrong drive due to confusion).

Otherwise, I find "hot spare" misleading and it should be renamed.

-- 
Regards,
Kai

Replies to list-only preferred.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04  0:00 ` [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Kai Krakow
@ 2016-04-04  4:45   ` Duncan
  2016-04-04  6:09     ` Duncan
  2016-04-04 20:15     ` Kai Krakow
  2016-04-04  6:19   ` Anand Jain
  1 sibling, 2 replies; 30+ messages in thread
From: Duncan @ 2016-04-04  4:45 UTC (permalink / raw)
  To: linux-btrfs

Kai Krakow posted on Mon, 04 Apr 2016 02:00:43 +0200 as excerpted:

> Does this also implement "copy-back" - thus, it returns the hot-spare
> device to global hot-spares when the failed device has been replaced?

I don't believe it does that in this initial implementation, anyway.

There's a number of issues with the initial implementation, including the 
fact that the hot-spare is global only and can't be specifically assigned 
to a filesystem or set of filesystems, which means, if you have multiple 
filesystems using different sized devices, the hot-spares must be sized 
to match the largest device they could replace, and thus would be mostly 
wasted if they ended up replacing a far smaller device.  If the spares 
could be associated with specific filesystems, then specifically sized 
spares could be associated appropriately, avoiding that waste.  
Additionally, it would then be possible to queue up say 20 spares on an 
important filesystem, with no spares on another that you'd rather just go 
down if a device fails.

So obviously the initial implementation isn't seriously enterprise-ready 
and is sub-optimal in many ways, but it's better than what is currently 
available (no automated spare handling at all), and an implementation 
must start somewhere, so as long as it's designed to be improved and 
extended with the missing features over time, as has been indicated, it's 
a reasonable first-implementation.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04  4:45   ` Duncan
@ 2016-04-04  6:09     ` Duncan
  2016-04-04 20:15     ` Kai Krakow
  1 sibling, 0 replies; 30+ messages in thread
From: Duncan @ 2016-04-04  6:09 UTC (permalink / raw)
  To: linux-btrfs

Duncan posted on Mon, 04 Apr 2016 04:45:16 +0000 as excerpted:

> Kai Krakow posted on Mon, 04 Apr 2016 02:00:43 +0200 as excerpted:
> 
>> Does this also implement "copy-back" - thus, it returns the hot-spare
>> device to global hot-spares when the failed device has been replaced?
> 
> I don't believe it does that in this initial implementation, anyway.
> 
> There's a number of issues with the initial implementation, including
> the fact that the hot-spare is global only and can't be specifically
> assigned to a filesystem or set of filesystems, which means, if you have
> multiple filesystems using different sized devices, the hot-spares must
> be sized to match the largest device they could replace,

Obviously the sizes issue is problematic for the hot-spare-return 
situation as well, since it would then be possible for an appropriately 
large replacement device to replace a much smaller device on some 
filesystem, which would then put the much smaller device into rotation as 
a hot-spare where it could end up picked to replace a far larger device.  
As there's currently no intelligence as to device sizes, etc, it just 
picks the next device in the hot-spares list and tries to use it, oops!

So hot-spare-return really will need to wait until per-filesystem hot-
spares and/or some sizing intelligence is added.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04  0:00 ` [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Kai Krakow
  2016-04-04  4:45   ` Duncan
@ 2016-04-04  6:19   ` Anand Jain
  2016-04-04 20:07     ` Kai Krakow
  1 sibling, 1 reply; 30+ messages in thread
From: Anand Jain @ 2016-04-04  6:19 UTC (permalink / raw)
  To: Kai Krakow, linux-btrfs



On 04/04/2016 08:00 AM, Kai Krakow wrote:
> Am Sat,  2 Apr 2016 09:30:38 +0800
> schrieb Anand Jain <anand.jain@oracle.com>:
>
>> Auto replace:
>>   Replace happens automatically, that is when there is any write
>>   failed or flush failed, the device will be marked as failed, which
>>   will stop any further IO attempt to that device. And in the next
>>   commit cycle the auto replace will pick the spare device to
>>   replace the failed device. And so the btrfs volume is back to a
>>   healthy state.
>
> Does this also implement "copy-back" - thus, it returns the hot-spare
> device to global hot-spares when the failed device has been replaced?

  Actually no. That means +1x more IO.

> Traditionally, the wording "hot spare" implies that the storage
> system runs a copy-back operation when the failing device has been
> replaced. The "hot spare" device then returns to its original "hot
> spare" function: sitting and waiting to jump in place...



> This also helps to keep your drives order in your storage enclosure.
> Without copy-back, the association between member drive and storage
> enclosure would fluctuate over time and you'd have to constantly update
> documentation.
> Add many identical systems, and you have a lot of
> different system configurations over time with individual
> documentation. This becomes confusing at best, and turns out
> dangerously probably (when pulling the wrong drive due to confusion).

   Noted and I agree, its always been very challenging in this area
   at the data centers.

   But strictly speaking its an enclosure services RFC to
   mitigate the issue of poor SW/CLI UI with hardware slots.
   ZFSSA HW added few more LEDs to help, I am not too sure
   but other recent HWs should have / might have enhancements
   in this area to help easy mapping/management.
   Further for the reason above, we shouldn't fix the problem at
   the wrong side, copy-back involves more IO, but.. I agree
   naming can be better to avoid confusion as such.

> Otherwise, I find "hot spare" misleading and it should be renamed.

  I never thought hot spare would be narrowed to such a specifics.
  When I wrote Solaris cpqarray (it was a very long time back
  though) I remember some RAID+JBOD HW wanted a strict disks ordering
  for _performance-reasons_, which made stronger reasons to have
  copy-back.

  Further in the long term what we need in btrfs is disk based tagging
  and grouping, that is it will help to create a btrfs across mixed
  types of JBODs, and then I hope it shall take care of narrower
  group based spare assignments.

  If there is any further reasons that copy-back should be a feature
  I think its ok to have it as an optional feature.

  About the naming.. the progs called it 'global spare' (device),
  kernel calls is 'spare'. Sorry this email thread called it
  hot spare. I should have paid little more attention here to maintain
  consistency.

  Thanks for the note.

Anand

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04  6:19   ` Anand Jain
@ 2016-04-04 20:07     ` Kai Krakow
  0 siblings, 0 replies; 30+ messages in thread
From: Kai Krakow @ 2016-04-04 20:07 UTC (permalink / raw)
  To: linux-btrfs

Am Mon, 4 Apr 2016 14:19:23 +0800
schrieb Anand Jain <anand.jain@oracle.com>:

> > Otherwise, I find "hot spare" misleading and it should be renamed.  
> 
>   I never thought hot spare would be narrowed to such a specifics.
[...]
>   About the naming.. the progs called it 'global spare' (device),
>   kernel calls is 'spare'. Sorry this email thread called it
>   hot spare. I should have paid little more attention here to maintain
>   consistency.
> 
>   Thanks for the note.

I think that's okay. Maybe man pages / doc should put a note that
there's no copy-back and that the spare takes a permanent replacement
role.

Side note: When I started managing hardware RAIDs a few years back,
"hot spare" wasn't very clear to me, and I didn't understand why there
is a copy-back operation (given that "useless" +1x IO). But in the long
term it keeps drive arrangement at expectations - which is good.

RAID board manufacturers seem to differentiate between those two
replacement strategies - and "hot spare" always involved copy-back for
me: The spare drive automatically returns to its hot spare role. I
learned to like this strategy. It has some advantages.

You could instead assign a replacement drive - then drives will become
rearranged in the array. This is usually done by just onlining one
spare disk, start a replace action, then offline the old drive and pull
it from the array. It's not "hot" in that sense. It's been unconfigured
good. Not sure if this could be automated - I did it this way only when
the array hasn't been equipped with a spare inside the enclosure but
the drive being still in its original box. Other than that, I always
used the hot spare method.

That's why I stumbled across...

-- 
Regards,
Kai

Replies to list-only preferred.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04  4:45   ` Duncan
  2016-04-04  6:09     ` Duncan
@ 2016-04-04 20:15     ` Kai Krakow
  2016-04-05  3:02       ` Duncan
  1 sibling, 1 reply; 30+ messages in thread
From: Kai Krakow @ 2016-04-04 20:15 UTC (permalink / raw)
  To: linux-btrfs

Am Mon, 4 Apr 2016 04:45:16 +0000 (UTC)
schrieb Duncan <1i5t5.duncan@cox.net>:

> Kai Krakow posted on Mon, 04 Apr 2016 02:00:43 +0200 as excerpted:
> 
> > Does this also implement "copy-back" - thus, it returns the
> > hot-spare device to global hot-spares when the failed device has
> > been replaced?  
> 
> I don't believe it does that in this initial implementation, anyway.
> 
> There's a number of issues with the initial implementation, including
> the fact that the hot-spare is global only and can't be specifically
> assigned to a filesystem or set of filesystems, which means, if you
> have multiple filesystems using different sized devices, the
> hot-spares must be sized to match the largest device they could
> replace, and thus would be mostly wasted if they ended up replacing a
> far smaller device.  If the spares could be associated with specific
> filesystems, then specifically sized spares could be associated
> appropriately, avoiding that waste. Additionally, it would then be
> possible to queue up say 20 spares on an important filesystem, with
> no spares on another that you'd rather just go down if a device fails.
> 
> So obviously the initial implementation isn't seriously
> enterprise-ready and is sub-optimal in many ways, but it's better
> than what is currently available (no automated spare handling at
> all), and an implementation must start somewhere, so as long as it's
> designed to be improved and extended with the missing features over
> time, as has been indicated, it's a reasonable first-implementation.

Your argument would be less important if it did copy-back, tho... ;-)

It's a very welcome and good start, I didn't mean to talk it useless.
By no way.

But to handle it right, that point should be clear. Currently, if the
global spare jumps in, you can always simulate "hot spare" by manually
putting back a correctly sized drive, then remove the spare again to
simulate copy-back, then make it global spare again.

Since such an incident needs manual investigation anyways, it's totally
reasonable to start with this implementation.

This sort of handling could be made into a guide within the docs.

-- 
Regards,
Kai

Replies to list-only preferred.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace
  2016-04-04 20:15     ` Kai Krakow
@ 2016-04-05  3:02       ` Duncan
  0 siblings, 0 replies; 30+ messages in thread
From: Duncan @ 2016-04-05  3:02 UTC (permalink / raw)
  To: linux-btrfs

Kai Krakow posted on Mon, 04 Apr 2016 22:15:13 +0200 as excerpted:

> Your argument would be less important if it did copy-back, tho... ;-)

FWIW, I completely misunderstood your description of copy-back in my 
original reply, and didn't realize what you meant (and thus my mistaken 
understanding) until I read some of the other replies today.

What I /thought/ you meant was some totally nonsense/WTF idea of keeping 
the newly substituted hot-spare in place, and taking the newly vacated 
"defective" device and putting it back in the the hot-spare list.

That rightly seemed stupid to me (it's a device just replaced as 
defective, now you're putting it back as a hot-spare? WTF?), but that's 
how I read what you were asking for and saying that other solutions did, 
so...

Of course today when I read the other replies and realized what you were 
/actually/ describing, returning the hot-spare to hot-spare status after 
physically replacing the actually failed drive with a new one and 
logically replacing the hot-spare with it in the filesystem, thereby 
making the hot-spare a spare once again, my reaction was "DUH!! NOW it 
makes sense!"  But I was just going to let it go and go hide my original 
misunderstanding in a hole somewhere.

But now you replied to my reply, so I figured I would reply back, 
explaining what on earth I was thinking when I wrote it, and why it must 
have seemed rather out of left field and didn't make much sense -- 
because what I was thinking you were suggesting /didn't/ make sense, but 
of course that's because I totally misunderstood what you were suggesting.

So now my very-much-former misunderstanding is out of the hole and posted 
for everyone to see and have a good laugh at, and I'm much the wiser on 
what copy-back actually entails. =:^)

Tho it seems I was correct in the one aspect, currently ENotImplemented, 
even if my idea of what you were asking to be implemented was totally and 
completely off-the-wall wrong.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
  2016-04-02  5:40   ` kbuild test robot
@ 2016-04-07 20:00   ` Yauhen Kharuzhy
  2016-04-08  3:58     ` Anand Jain
  2016-04-08 22:05   ` Yauhen Kharuzhy
  2 siblings, 1 reply; 30+ messages in thread
From: Yauhen Kharuzhy @ 2016-04-07 20:00 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Sat, Apr 02, 2016 at 09:30:48AM +0800, Anand Jain wrote:
> Hot replace / auto replace is important volume manager feature
> and is critical to the data center operations, so that the degraded
> volume can be brought back to a healthy state at the earliest and
> without manual intervention.
> 
> This modifies the existing replace code to suite the need of auto
> replace, in the long run I hope both the codes to be merged.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
> ---
>  fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  fs/btrfs/dev-replace.h |  1 +
>  2 files changed, 44 insertions(+)
> 
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 2b926867d136..ceab4c51db32 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
>  				     &fs_info->fs_state));
>  	}
>  }
> +
> +int btrfs_auto_replace_start(struct btrfs_root *root,
> +				struct btrfs_device *src_device)
> +{
> +	int ret;
> +	char *tgt_path;
> +	char *src_path;
> +	struct btrfs_fs_info *fs_info = root->fs_info;
> +
> +	if (fs_info->sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +
> +	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
> +	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
> +		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +		return -EBUSY;
> +	}
> +	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +
> +	if (btrfs_get_spare_device(&tgt_path)) {
> +		btrfs_err(root->fs_info,
> +			"No spare device found/configured in the kernel");
> +		return -EINVAL;
> +	}
> +
> +	rcu_read_lock();
> +	src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
> +	rcu_read_unlock();
> +	if (!src_path) {

btrfs_put_spare_device(tgt_path) is needed here to put spare device
back in list.

> +		kfree(tgt_path);
> +		return -ENOMEM;
> +	}
> +	ret = btrfs_dev_replace_start(root, tgt_path,
> +					src_device->devid, src_path,
> +		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
> +	if (ret)
> +		btrfs_put_spare_device(tgt_path);
> +
> +	kfree(tgt_path);
> +	kfree(src_path);
> +
> +	return 0;
> +}
> diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
> index e922b42d91df..b918b9d6e5df 100644
> --- a/fs/btrfs/dev-replace.h
> +++ b/fs/btrfs/dev-replace.h
> @@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
>  {
>  	atomic64_inc(stat_value);
>  }
> +int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
>  #endif
> -- 
> 2.7.0

-- 
Yauhen Kharuzhy

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-07 20:00   ` Yauhen Kharuzhy
@ 2016-04-08  3:58     ` Anand Jain
  0 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-08  3:58 UTC (permalink / raw)
  To: Yauhen Kharuzhy; +Cc: linux-btrfs



On 04/08/2016 04:00 AM, Yauhen Kharuzhy wrote:
> On Sat, Apr 02, 2016 at 09:30:48AM +0800, Anand Jain wrote:
>> Hot replace / auto replace is important volume manager feature
>> and is critical to the data center operations, so that the degraded
>> volume can be brought back to a healthy state at the earliest and
>> without manual intervention.
>>
>> This modifies the existing replace code to suite the need of auto
>> replace, in the long run I hope both the codes to be merged.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
>> ---
>>   fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>>   fs/btrfs/dev-replace.h |  1 +
>>   2 files changed, 44 insertions(+)
>>
>> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
>> index 2b926867d136..ceab4c51db32 100644
>> --- a/fs/btrfs/dev-replace.c
>> +++ b/fs/btrfs/dev-replace.c
>> @@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
>>   				     &fs_info->fs_state));
>>   	}
>>   }
>> +
>> +int btrfs_auto_replace_start(struct btrfs_root *root,
>> +				struct btrfs_device *src_device)
>> +{
>> +	int ret;
>> +	char *tgt_path;
>> +	char *src_path;
>> +	struct btrfs_fs_info *fs_info = root->fs_info;
>> +
>> +	if (fs_info->sb->s_flags & MS_RDONLY)
>> +		return -EROFS;
>> +
>> +	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
>> +	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
>> +		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
>> +		return -EBUSY;
>> +	}
>> +	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
>> +
>> +	if (btrfs_get_spare_device(&tgt_path)) {
>> +		btrfs_err(root->fs_info,
>> +			"No spare device found/configured in the kernel");
>> +		return -EINVAL;
>> +	}
>> +
>> +	rcu_read_lock();
>> +	src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
>> +	rcu_read_unlock();
>> +	if (!src_path) {
>
> btrfs_put_spare_device(tgt_path) is needed here to put spare device
> back in list.

  Right. Got that changed locally. Thanks.

Anand

>> +		kfree(tgt_path);
>> +		return -ENOMEM;
>> +	}
>> +	ret = btrfs_dev_replace_start(root, tgt_path,
>> +					src_device->devid, src_path,
>> +		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
>> +	if (ret)
>> +		btrfs_put_spare_device(tgt_path);
>> +
>> +	kfree(tgt_path);
>> +	kfree(src_path);
>> +
>> +	return 0;
>> +}
>> diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
>> index e922b42d91df..b918b9d6e5df 100644
>> --- a/fs/btrfs/dev-replace.h
>> +++ b/fs/btrfs/dev-replace.h
>> @@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
>>   {
>>   	atomic64_inc(stat_value);
>>   }
>> +int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
>>   #endif
>> --
>> 2.7.0
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
  2016-04-02  5:40   ` kbuild test robot
  2016-04-07 20:00   ` Yauhen Kharuzhy
@ 2016-04-08 22:05   ` Yauhen Kharuzhy
  2016-04-12 14:16     ` Anand Jain
  2 siblings, 1 reply; 30+ messages in thread
From: Yauhen Kharuzhy @ 2016-04-08 22:05 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Sat, Apr 02, 2016 at 09:30:48AM +0800, Anand Jain wrote:
> Hot replace / auto replace is important volume manager feature
> and is critical to the data center operations, so that the degraded
> volume can be brought back to a healthy state at the earliest and
> without manual intervention.
> 
> This modifies the existing replace code to suite the need of auto
> replace, in the long run I hope both the codes to be merged.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
> ---
>  fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  fs/btrfs/dev-replace.h |  1 +
>  2 files changed, 44 insertions(+)
> 
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 2b926867d136..ceab4c51db32 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
>  				     &fs_info->fs_state));
>  	}
>  }
> +
> +int btrfs_auto_replace_start(struct btrfs_root *root,
> +				struct btrfs_device *src_device)
> +{
> +	int ret;
> +	char *tgt_path;
> +	char *src_path;
> +	struct btrfs_fs_info *fs_info = root->fs_info;
> +
> +	if (fs_info->sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +
> +	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
> +	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
> +		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +		return -EBUSY;
> +	}
> +	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
> +
> +	if (btrfs_get_spare_device(&tgt_path)) {
> +		btrfs_err(root->fs_info,
> +			"No spare device found/configured in the kernel");
> +		return -EINVAL;
> +	}
> +
> +	rcu_read_lock();
> +	src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
> +	rcu_read_unlock();
> +	if (!src_path) {
> +		kfree(tgt_path);
> +		return -ENOMEM;
> +	}
> +	ret = btrfs_dev_replace_start(root, tgt_path,
> +					src_device->devid, src_path,
> +		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
> +	if (ret)
> +		btrfs_put_spare_device(tgt_path);
> +
> +	kfree(tgt_path);
> +	kfree(src_path);
> +
> +	return 0;
> +}

Without of fs_info->mutually_exclusive_operation_running flag set in
btrfs_auto_replace_start(), device add/remove/balance etc. can be
started in parralel with autoreplace. Should this scenarios be permitted?

> diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
> index e922b42d91df..b918b9d6e5df 100644
> --- a/fs/btrfs/dev-replace.h
> +++ b/fs/btrfs/dev-replace.h
> @@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
>  {
>  	atomic64_inc(stat_value);
>  }
> +int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
>  #endif
> -- 
> 2.7.0

-- 
Yauhen Kharuzhy

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-08 22:05   ` Yauhen Kharuzhy
@ 2016-04-12 14:16     ` Anand Jain
  0 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-12 14:16 UTC (permalink / raw)
  To: Yauhen Kharuzhy; +Cc: linux-btrfs, dsterba



On 04/09/2016 06:05 AM, Yauhen Kharuzhy wrote:
> On Sat, Apr 02, 2016 at 09:30:48AM +0800, Anand Jain wrote:
>> Hot replace / auto replace is important volume manager feature
>> and is critical to the data center operations, so that the degraded
>> volume can be brought back to a healthy state at the earliest and
>> without manual intervention.
>>
>> This modifies the existing replace code to suite the need of auto
>> replace, in the long run I hope both the codes to be merged.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
>> ---
>>   fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>>   fs/btrfs/dev-replace.h |  1 +
>>   2 files changed, 44 insertions(+)
>>
>> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
>> index 2b926867d136..ceab4c51db32 100644
>> --- a/fs/btrfs/dev-replace.c
>> +++ b/fs/btrfs/dev-replace.c
>> @@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
>>   				     &fs_info->fs_state));
>>   	}
>>   }
>> +
>> +int btrfs_auto_replace_start(struct btrfs_root *root,
>> +				struct btrfs_device *src_device)
>> +{
>> +	int ret;
>> +	char *tgt_path;
>> +	char *src_path;
>> +	struct btrfs_fs_info *fs_info = root->fs_info;
>> +
>> +	if (fs_info->sb->s_flags & MS_RDONLY)
>> +		return -EROFS;
>> +
>> +	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
>> +	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
>> +		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
>> +		return -EBUSY;
>> +	}
>> +	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
>> +
>> +	if (btrfs_get_spare_device(&tgt_path)) {
>> +		btrfs_err(root->fs_info,
>> +			"No spare device found/configured in the kernel");
>> +		return -EINVAL;
>> +	}
>> +
>> +	rcu_read_lock();
>> +	src_path = kstrdup(rcu_str_deref(src_device->name), GFP_ATOMIC);
>> +	rcu_read_unlock();
>> +	if (!src_path) {
>> +		kfree(tgt_path);
>> +		return -ENOMEM;
>> +	}
>> +	ret = btrfs_dev_replace_start(root, tgt_path,
>> +					src_device->devid, src_path,
>> +		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
>> +	if (ret)
>> +		btrfs_put_spare_device(tgt_path);
>> +
>> +	kfree(tgt_path);
>> +	kfree(src_path);
>> +
>> +	return 0;
>> +}
>
> Without of fs_info->mutually_exclusive_operation_running flag set in
> btrfs_auto_replace_start(), device add/remove/balance etc. can be
> started in parralel with autoreplace. Should this scenarios be permitted?

  Its needs it in case of if device delete/add etc is running, added
  in v4.  Thanks.


>> diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
>> index e922b42d91df..b918b9d6e5df 100644
>> --- a/fs/btrfs/dev-replace.h
>> +++ b/fs/btrfs/dev-replace.h
>> @@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
>>   {
>>   	atomic64_inc(stat_value);
>>   }
>> +int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
>>   #endif
>> --
>> 2.7.0
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-05-10 14:09 [PATCH v6 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
@ 2016-05-10 14:09 ` Anand Jain
  0 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-05-10 14:09 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, yauhen.kharuzhy

From: Anand Jain <Anand.Jain@oracle.com>

Hot replace / auto replace is important volume manager feature
and is critical to the data center operations, so that the degraded
volume can be brought back to a healthy state at the earliest and
without manual intervention.

This modifies the existing replace code to suite the need of auto
replace, in the long run I hope both the codes to be merged.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
Tested-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
---
v6: update the printk for space device error to ratelimit

 fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/dev-replace.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 5ec7fa860391..83af64907547 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -937,3 +937,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
 				     &fs_info->fs_state));
 	}
 }
+
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid)
+{
+	int ret;
+	char *tgt_path;
+	struct btrfs_fs_info *fs_info = root->fs_info;
+
+	if (!src_devid)
+		return -EINVAL;
+
+	if (fs_info->sb->s_flags & MS_RDONLY)
+		return -EROFS;
+
+	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
+	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
+		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		return -EBUSY;
+	}
+	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+
+	if (btrfs_get_spare_device(&tgt_path)) {
+		btrfs_info_rl(root->fs_info,
+			"No spare device found/configured in the kernel");
+		return -EINVAL;
+	}
+
+	if (atomic_xchg(
+		&root->fs_info->mutually_exclusive_operation_running, 1)) {
+		ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
+	} else {
+		ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
+		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS);
+		atomic_set(
+			&root->fs_info->mutually_exclusive_operation_running, 0);
+	}
+
+	if (ret)
+		btrfs_put_spare_device(tgt_path);
+
+	kfree(tgt_path);
+
+	return ret;
+}
diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
index e922b42d91df..54b0812c8ba4 100644
--- a/fs/btrfs/dev-replace.h
+++ b/fs/btrfs/dev-replace.h
@@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
 {
 	atomic64_inc(stat_value);
 }
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid);
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-18 11:31 [PATCH v5 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
@ 2016-04-18 11:31 ` Anand Jain
  0 siblings, 0 replies; 30+ messages in thread
From: Anand Jain @ 2016-04-18 11:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, yauhen.kharuzhy

From: Anand Jain <Anand.Jain@oracle.com>

Hot replace / auto replace is important volume manager feature
and is critical to the data center operations, so that the degraded
volume can be brought back to a healthy state at the earliest and
without manual intervention.

This modifies the existing replace code to suite the need of auto
replace, in the long run I hope both the codes to be merged.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/dev-replace.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index be0958de9f2d..db323f2bb1ef 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -956,3 +956,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
 				     &fs_info->fs_state));
 	}
 }
+
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid)
+{
+	int ret;
+	char *tgt_path;
+	struct btrfs_fs_info *fs_info = root->fs_info;
+
+	if (!src_devid)
+		return -EINVAL;
+
+	if (fs_info->sb->s_flags & MS_RDONLY)
+		return -EROFS;
+
+	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
+	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
+		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		return -EBUSY;
+	}
+	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+
+	if (btrfs_get_spare_device(&tgt_path)) {
+		btrfs_err(root->fs_info,
+			"No spare device found/configured in the kernel");
+		return -EINVAL;
+	}
+
+	if (atomic_xchg(
+		&root->fs_info->mutually_exclusive_operation_running, 1)) {
+		ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
+	} else {
+		ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
+		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS);
+		atomic_set(
+			&root->fs_info->mutually_exclusive_operation_running, 0);
+	}
+
+	if (ret)
+		btrfs_put_spare_device(tgt_path);
+
+	kfree(tgt_path);
+
+	return ret;
+}
diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
index e922b42d91df..54b0812c8ba4 100644
--- a/fs/btrfs/dev-replace.h
+++ b/fs/btrfs/dev-replace.h
@@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
 {
 	atomic64_inc(stat_value);
 }
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid);
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-12 14:16 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
@ 2016-04-12 14:40   ` kbuild test robot
  0 siblings, 0 replies; 30+ messages in thread
From: kbuild test robot @ 2016-04-12 14:40 UTC (permalink / raw)
  To: Anand Jain; +Cc: kbuild-all, linux-btrfs, dsterba, yauhen.kharuzhy

[-- Attachment #1: Type: text/plain, Size: 2070 bytes --]

Hi Anand,

[auto build test ERROR on btrfs/next]
[also build test ERROR on v4.6-rc3 next-20160412]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Anand-Jain/Introduce-device-state-failed-spare-device-and-auto-replace/20160412-222557
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next
config: x86_64-randconfig-x010-201615 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/btrfs/dev-replace.c: In function 'btrfs_auto_replace_start':
   fs/btrfs/dev-replace.c:979:39: warning: passing argument 2 of 'btrfs_dev_replace_start' from incompatible pointer type [-Wincompatible-pointer-types]
      ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
                                          ^
   fs/btrfs/dev-replace.c:308:5: note: expected 'struct btrfs_ioctl_dev_replace_args *' but argument is of type 'char *'
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^
>> fs/btrfs/dev-replace.c:979:9: error: too many arguments to function 'btrfs_dev_replace_start'
      ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
            ^
   fs/btrfs/dev-replace.c:308:5: note: declared here
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^

vim +/btrfs_dev_replace_start +979 fs/btrfs/dev-replace.c

   973		}
   974	
   975		if (atomic_xchg(
   976			&root->fs_info->mutually_exclusive_operation_running, 1)) {
   977			ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
   978		} else {
 > 979			ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
   980			BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS);
   981			atomic_set(
   982				&root->fs_info->mutually_exclusive_operation_running, 0);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 25015 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 10/13] btrfs: introduce helper functions to perform hot replace
  2016-04-12 14:15 [PATCH v4 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
@ 2016-04-12 14:16 ` Anand Jain
  2016-04-12 14:40   ` kbuild test robot
  0 siblings, 1 reply; 30+ messages in thread
From: Anand Jain @ 2016-04-12 14:16 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, yauhen.kharuzhy

From: Anand Jain <Anand.Jain@oracle.com>

Hot replace / auto replace is important volume manager feature
and is critical to the data center operations, so that the degraded
volume can be brought back to a healthy state at the earliest and
without manual intervention.

This modifies the existing replace code to suite the need of auto
replace, in the long run I hope both the codes to be merged.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
---
 fs/btrfs/dev-replace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/dev-replace.h |  1 +
 2 files changed, 44 insertions(+)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 2b926867d136..ddc4843604df 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -957,3 +957,46 @@ void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
 				     &fs_info->fs_state));
 	}
 }
+
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid)
+{
+	int ret;
+	char *tgt_path;
+	struct btrfs_fs_info *fs_info = root->fs_info;
+
+	if (!src_devid)
+		return -EINVAL;
+
+	if (fs_info->sb->s_flags & MS_RDONLY)
+		return -EROFS;
+
+	btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
+	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
+		btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+		return -EBUSY;
+	}
+	btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
+
+	if (btrfs_get_spare_device(&tgt_path)) {
+		btrfs_err(root->fs_info,
+			"No spare device found/configured in the kernel");
+		return -EINVAL;
+	}
+
+	if (atomic_xchg(
+		&root->fs_info->mutually_exclusive_operation_running, 1)) {
+		ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
+	} else {
+		ret = btrfs_dev_replace_start(root, tgt_path, src_devid, NULL,
+		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS);
+		atomic_set(
+			&root->fs_info->mutually_exclusive_operation_running, 0);
+	}
+
+	if (ret)
+		btrfs_put_spare_device(tgt_path);
+
+	kfree(tgt_path);
+
+	return ret;
+}
diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
index e922b42d91df..54b0812c8ba4 100644
--- a/fs/btrfs/dev-replace.h
+++ b/fs/btrfs/dev-replace.h
@@ -46,4 +46,5 @@ static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
 {
 	atomic64_inc(stat_value);
 }
+int btrfs_auto_replace_start(struct btrfs_root *root, u64 src_devid);
 #endif
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2016-05-10 14:09 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-02  1:30 [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Anand Jain
2016-04-02  1:30 ` [PATCH 01/13] btrfs: Introduce a new function to check if all chunks a OK for degraded mount Anand Jain
2016-04-02  1:30 ` [PATCH 02/13] btrfs: Do per-chunk check for mount time check Anand Jain
2016-04-02  1:30 ` [PATCH 03/13] btrfs: Do per-chunk degraded check for remount Anand Jain
2016-04-02  1:30 ` [PATCH 04/13] btrfs: Allow barrier_all_devices to do per-chunk device check Anand Jain
2016-04-02  1:30 ` [PATCH 05/13] btrfs: Cleanup num_tolerated_disk_barrier_failures Anand Jain
2016-04-02  1:30 ` [PATCH 06/13] btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV Anand Jain
2016-04-02  1:30 ` [PATCH 07/13] btrfs: add check not to mount a spare device Anand Jain
2016-04-02  1:30 ` [PATCH 08/13] btrfs: support btrfs dev scan for " Anand Jain
2016-04-02  1:30 ` [PATCH 09/13] btrfs: provide framework to get and put a " Anand Jain
2016-04-02  1:30 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
2016-04-02  5:40   ` kbuild test robot
2016-04-07 20:00   ` Yauhen Kharuzhy
2016-04-08  3:58     ` Anand Jain
2016-04-08 22:05   ` Yauhen Kharuzhy
2016-04-12 14:16     ` Anand Jain
2016-04-02  1:30 ` [PATCH 11/13] btrfs: introduce device dynamic state transition to offline or failed Anand Jain
2016-04-02  1:30 ` [PATCH 12/13] btrfs: check device for critical errors and mark failed Anand Jain
2016-04-02  1:30 ` [PATCH 13/13] btrfs: check for failed device and hot replace Anand Jain
2016-04-04  0:00 ` [PATCH 00/13 v3] Introduce device state 'failed', Hot spare and Auto replace Kai Krakow
2016-04-04  4:45   ` Duncan
2016-04-04  6:09     ` Duncan
2016-04-04 20:15     ` Kai Krakow
2016-04-05  3:02       ` Duncan
2016-04-04  6:19   ` Anand Jain
2016-04-04 20:07     ` Kai Krakow
2016-04-12 14:15 [PATCH v4 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
2016-04-12 14:16 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
2016-04-12 14:40   ` kbuild test robot
2016-04-18 11:31 [PATCH v5 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
2016-04-18 11:31 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain
2016-05-10 14:09 [PATCH v6 00/13] Introduce device state 'failed', spare device and auto replace Anand Jain
2016-05-10 14:09 ` [PATCH 10/13] btrfs: introduce helper functions to perform hot replace Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.