Skip to contentSkip to conversation

Btrfs: skip submitting barrier for missing device

PATCH New Hidetoshi Seto 1 participant 1 message Feb 5, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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:

Quoted 4 lines

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.

---
 fs/btrfs/disk-io.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/btrfs/disk-io.c +4 -0
index 8072cfa..7eb50f3 100644
@@ -3238,6 +3238,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 	/* send down all the barriers */
 	head = &info->fs_devices->devices;
 	list_for_each_entry_rcu(dev, head, dev_list) {
+		if (dev->missing)
+			continue;
 		if (!dev->bdev) {
 			errors_send++;
 			continue;
@@ -3252,6 +3254,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
 
 	/* wait for all the barriers */
 	list_for_each_entry_rcu(dev, head, dev_list) {
+		if (dev->missing)
+			continue;
 		if (!dev->bdev) {
 			errors_wait++;
 			continue;
Signature · 1 line
1.7.1