Skip to content

btrfs: fix issues due to alien device

Anand Jain linux-btrfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/23 patches 10 repliesIn review
  2. v3 posting 1/25 patches 14 repliesSuperseded
  3. v14 patches 8 repliesSuperseded

Patches in v3 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: drop useless goto in open_fs_devicesfs/btrfs/volumes.c+5 -71 reply
2/3btrfs: include non-missing as a qualifier for the latest_bdevfs/btrfs/volumes.c+2 -02 replies
3/3btrfs: free alien device due to device addfs/btrfs/volumes.c+13 -07 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchJosef BacikNikolay Borisov
1/3R-b R-b
2/3R-b
3/3R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 REBASED 0/3] btrfs: fix issues due to alien device

v3 REBASED: Based on the latest misc-next. for for-5.8.
Dropped the following patches as there were concerns about the usage of error code -EUCLEAN
btrfs: remove identified alien device in open_fs_devices
btrfs: remove identified alien btrfs device in open_fs_devices

Rmaining 3 patches here have obtained reviewed-by. With this pathset the pertaining fstests btrfs/197 and btrfs/198 (which tests 3 bugs) would pass as the patch 2/3 fixed a bug and 3/3 fixed the trigger of 2 other bugs (patch 1/3 is just a cleanup). Further at the moment I am not sure if there is any other trigger where it could again leave an alien device in the fs_devices leading to the same/similar bugs.

==== original email ====
v3: Fix alien device is due to wipefs in Patch4.
Fix a nit in Patch3.
Patches are reordered.

Alien device is a device in fs_devices list having a different fsid than the expected fsid or no btrfs_magic. This patch set fixes issues found due to the same.

Patch1: is a cleanup patch, not related.
Patch2: fixes failing to mount a degraded RAIDs (RAID1/5/6/10), by
hardening the function btrfs_free_extra_devids().
Patch3: fixes the missing device (due to alien btrfs-device) not missing in
the userland, by hardening the function btrfs_open_one_device().
Patch4: fixes the missing device (due to alien device) not missing in
the userland, by returning EUCLEAN in btrfs_read_dev_one_super().
Patch5: eliminates the source of the alien device in the fs_devices.

PS: Fundamentally its wrong approach that btrfs-progs deduces the device missing state in the userland instead of obtaining it from the kernel. I remember objecting on the btrfs-progs patch which did that, but still it got merged, bugs in p3 and p4 are its side effects. I wrote patches to read device_state from the kernel using ioctl, procfs and sysfs but it didn't get the due attention till a merger.

Anand Jain (3):
btrfs: drop useless goto in open_fs_devices
btrfs: include non-missing as a qualifier for the latest_bdev
btrfs: free alien device due to device add

 fs/btrfs/volumes.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)
Signature · 1 line
2.23.0