瀏覽代碼

Btrfs: skip submitting barrier for missing device

I got an error on v3.13:
 BTRFS error (device sdf1) in write_all_supers:3378: errno=-5 IO failure (errors while submitting device barriers.)

how to reproduce:
  > mkfs.btrfs -f -d raid1 /dev/sdf1 /dev/sdf2
  > wipefs -a /dev/sdf2
  > mount -o degraded /dev/sdf1 /mnt
  > btrfs balance start -f -sconvert=single -mconvert=single -dconvert=single /mnt

The reason of the error is that barrier_all_devices() failed to submit
barrier to the missing device.  However it is clear that we cannot do
anything on missing device, and also it is not necessary to care chunks
on the missing device.

This patch stops sending/waiting barrier if device is missing.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Hidetoshi Seto 12 年之前
父節點
當前提交
f88ba6a2a4
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      fs/btrfs/disk-io.c

+ 4 - 0
fs/btrfs/disk-io.c

@@ -3256,6 +3256,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 	/* send down all the barriers */
 	/* send down all the barriers */
 	head = &info->fs_devices->devices;
 	head = &info->fs_devices->devices;
 	list_for_each_entry_rcu(dev, head, dev_list) {
 	list_for_each_entry_rcu(dev, head, dev_list) {
+		if (dev->missing)
+			continue;
 		if (!dev->bdev) {
 		if (!dev->bdev) {
 			errors_send++;
 			errors_send++;
 			continue;
 			continue;
@@ -3270,6 +3272,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 
 
 	/* wait for all the barriers */
 	/* wait for all the barriers */
 	list_for_each_entry_rcu(dev, head, dev_list) {
 	list_for_each_entry_rcu(dev, head, dev_list) {
+		if (dev->missing)
+			continue;
 		if (!dev->bdev) {
 		if (!dev->bdev) {
 			errors_wait++;
 			errors_wait++;
 			continue;
 			continue;