-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAID0 btrfs root missing device #194
Comments
Thank you for the report. What is the |
Possibly related to #193, I believe there's supposed to be a hook for btrfs that waits for devices to be ready before attempting to mount |
And only after that proceed with mounting Fixes #194
I added an integration test that exposes this problem. I checked btrfs toolset and see I checked the tool sourcecode and all this command does is Unfortunately, it does not work. Here is the kernel log from the test:
Does BTRFS_IOC_DEVICES_READY really wait until the whole array is ready? cc some folks who know the kernel btrfs logic better @adam900710 @fdmanana |
In case of multidevice btrfs we need to make sure the devices are ready before we can assemle the array. Call ioctl(BTRFS_IOC_DEVICES_READY) which is exactly what `btrfs device ready $dev` user-space tool does. Fixes #194
I just pushed a commit that aims to fix this bug. Could you please pull |
Sorry for hijacking this topic, I didn't saw it yesterday and created this in discussion section #195. I tried this new commit but didn't change anything, but maybe I'm doing something wrong. If I have two encrypted disks I only need to put once root information for it?
|
Hi @roland-rollo, your issue sounds related to this one. Could you please enable debug log with |
@roland-rollo I expect that the kernel logs also have a line like |
In case of multidevice btrfs we need to make sure the devices are ready before we can assemle the array. Call ioctl(BTRFS_IOC_DEVICES_READY) which is exactly what `btrfs device ready $dev` user-space tool does. Fixes #194
In case of multidevice btrfs we need to make sure the devices are ready before we can assemle the array. Call ioctl(BTRFS_IOC_DEVICES_READY) which is exactly what `btrfs device ready $dev` user-space tool does. Fixes #194
In case of multidevice btrfs we need to make sure the devices are ready before we can assemle the array. Call ioctl(BTRFS_IOC_DEVICES_READY) which is exactly what `btrfs device ready $dev` user-space tool does. Fixes #194
In case of multidevice btrfs we need to make sure the devices are ready before we can assemle the array. Call ioctl(BTRFS_IOC_DEVICES_READY) which is exactly what `btrfs device ready $dev` user-space tool does. Fixes #194
@anatol Yes, I used |
In some cases (e.g. root on multi-device btrfs) mount() for the first discovered devices fails, as the array is not fully assembled yet. Keep trying block devices until the array is assembled. Closes #194
@roland-rollo I pushed another proposed fix to |
@anatol Gloria, May Linus Torvalds bless you! It show error, but booted without problem. Without scrolling, my configuration:
Here is log with error. Tried |
The new solution I provided tries to mount the root partition until it succeeds. In the case of RAID0 once the first device is registered and booster tries to mount it fails as the array is not fully assembled. With the next block device, it succeeds. |
If we want to mount a root partition located at a btrfs multi-device (e.g. RAID0) then booster needs to wait until all these devices are detected and registered by the kernel. This situation is similar to mdraid codepath. Btrfs provides BTRFS_IOC_DEVICES_READY iotcl command that according to the description supposed to act as a synchronization barrier and wait till all devices of an array are detected. Unfortunately, it does not behave this way. Instead, we just keep calling mount() for each newly detected btrfs device until the call succeeds. Fixes #194
If we want to mount a root partition located at a btrfs multi-device (e.g. RAID0) then booster needs to wait until all these devices are detected and registered by the kernel. This situation is similar to mdraid codepath. Btrfs provides BTRFS_IOC_DEVICES_READY iotcl command that according to the description supposed to act as a synchronization barrier and wait till all devices of an array are detected. Unfortunately, it does not behave this way. Instead, we just keep calling mount() for each newly detected btrfs device until the call succeeds. Fixes #194
That helps when we build btrfs RAID0 and fixes following race condition in tests: [ 1.608465] booster: loading module btrfs [ 1.695250] Btrfs loaded, crc32c=crc32c-intel, zoned=yes, fsverity=yes [ 1.695410] booster: udev event {Action:add KObj:/devices/virtual/misc/btrfs-control Env:map[ACTION:add DEVNAME:btrfs-control DEVPATH:/devices/virtual/misc/btrfs-control MAJOR:10 MINOR:234 SEQNUM:1156 SUBSYSTEM:misc]} [ 1.698089] booster: udev event {Action:add KObj:/module/btrfs Env:map[ACTION:add DEVPATH:/module/btrfs SEQNUM:1157 SUBSYSTEM:module]} [ 1.699492] booster: mounting /dev/sda1->/booster.root, fs=btrfs, flags=0x0, options= [ 1.700392] BTRFS: device fsid 5eaa0c1c-e1dc-4be7-9b03-9f1ed5a87289 devid 1 transid 8 /dev/sda1 scanned by init (129) [ 1.701508] booster: udev event {Action:add KObj:/devices/virtual/bdi/btrfs-1 Env:map[ACTION:add DEVPATH:/devices/virtual/bdi/btrfs-1 SEQNUM:1158 SUBSYSTEM:bdi]} [ 1.703030] BTRFS info (device sda1): using crc32c (crc32c-intel) checksum algorithm [ 1.703796] BTRFS info (device sda1): using free space tree [ 1.704984] BTRFS error (device sda1): devid 2 uuid c815d0ba-796d-4b7c-a5a9-3e6852c6ed0a is missing [ 1.705846] BTRFS error (device sda1): failed to read the system array: -2 [ 1.706784] BTRFS error (device sda1): open_ctree failed [ 1.707380] booster: mount(/dev/sda1): invalid argument [ 1.707924] booster: mounting /dev/sda2->/booster.root, fs=btrfs, flags=0x0, options= [ 1.708708] booster: udev event {Action:remove KObj:/devices/virtual/bdi/btrfs-1 Env:map[ACTION:remove DEVPATH:/devices/virtual/bdi/btrfs-1 SEQNUM:1159 SUBSYSTEM:bdi]} [ 1.708780] BTRFS: device fsid 5eaa0c1c-e1dc-4be7-9b03-9f1ed5a87289 devid 2 transid 8 /dev/sda2 scanned by init (129) [ 1.711416] booster: udev event {Action:add KObj:/devices/virtual/bdi/btrfs-2 Env:map[ACTION:add DEVPATH:/devices/virtual/bdi/btrfs-2 SEQNUM:1160 SUBSYSTEM:bdi]} [ 1.711548] BTRFS info (device sda2): using crc32c (crc32c-intel) checksum algorithm [ 1.714017] BTRFS info (device sda2): using free space tree [ 1.715232] BTRFS error (device sda2): devid 1 uuid 58a3e858-0b27-4f7c-8aa5-0dfed774177a is missing [ 1.716119] BTRFS error (device sda2): failed to read the system array: -2 [ 1.717021] BTRFS error (device sda2): open_ctree failed [ 1.717599] booster: mount(/dev/sda2): invalid argument [ 1.718186] booster: udev event {Action:remove KObj:/devices/virtual/bdi/btrfs-2 Env:map[ACTION:remove DEVPATH:/devices/virtual/bdi/btrfs-2 SEQNUM:1161 SUBSYSTEM:bdi]} btrfs_test.go:17: Error Trace: /home/anatol/sources/golang/booster/tests/btrfs_test.go:17 Error: Received unexpected error: EOF Test: TestBtrfsRaid0 2023/02/28 17:53:15 Got error while waiting for Qemu process completion: signal: killed --- FAIL: TestBtrfsRaid0 (41.28s) Issue #194
That helps when we build btrfs RAID0 and fixes following race condition in tests: [ 1.608465] booster: loading module btrfs [ 1.695250] Btrfs loaded, crc32c=crc32c-intel, zoned=yes, fsverity=yes [ 1.695410] booster: udev event {Action:add KObj:/devices/virtual/misc/btrfs-control Env:map[ACTION:add DEVNAME:btrfs-control DEVPATH:/devices/virtual/misc/btrfs-control MAJOR:10 MINOR:234 SEQNUM:1156 SUBSYSTEM:misc]} [ 1.698089] booster: udev event {Action:add KObj:/module/btrfs Env:map[ACTION:add DEVPATH:/module/btrfs SEQNUM:1157 SUBSYSTEM:module]} [ 1.699492] booster: mounting /dev/sda1->/booster.root, fs=btrfs, flags=0x0, options= [ 1.700392] BTRFS: device fsid 5eaa0c1c-e1dc-4be7-9b03-9f1ed5a87289 devid 1 transid 8 /dev/sda1 scanned by init (129) [ 1.701508] booster: udev event {Action:add KObj:/devices/virtual/bdi/btrfs-1 Env:map[ACTION:add DEVPATH:/devices/virtual/bdi/btrfs-1 SEQNUM:1158 SUBSYSTEM:bdi]} [ 1.703030] BTRFS info (device sda1): using crc32c (crc32c-intel) checksum algorithm [ 1.703796] BTRFS info (device sda1): using free space tree [ 1.704984] BTRFS error (device sda1): devid 2 uuid c815d0ba-796d-4b7c-a5a9-3e6852c6ed0a is missing [ 1.705846] BTRFS error (device sda1): failed to read the system array: -2 [ 1.706784] BTRFS error (device sda1): open_ctree failed [ 1.707380] booster: mount(/dev/sda1): invalid argument [ 1.707924] booster: mounting /dev/sda2->/booster.root, fs=btrfs, flags=0x0, options= [ 1.708708] booster: udev event {Action:remove KObj:/devices/virtual/bdi/btrfs-1 Env:map[ACTION:remove DEVPATH:/devices/virtual/bdi/btrfs-1 SEQNUM:1159 SUBSYSTEM:bdi]} [ 1.708780] BTRFS: device fsid 5eaa0c1c-e1dc-4be7-9b03-9f1ed5a87289 devid 2 transid 8 /dev/sda2 scanned by init (129) [ 1.711416] booster: udev event {Action:add KObj:/devices/virtual/bdi/btrfs-2 Env:map[ACTION:add DEVPATH:/devices/virtual/bdi/btrfs-2 SEQNUM:1160 SUBSYSTEM:bdi]} [ 1.711548] BTRFS info (device sda2): using crc32c (crc32c-intel) checksum algorithm [ 1.714017] BTRFS info (device sda2): using free space tree [ 1.715232] BTRFS error (device sda2): devid 1 uuid 58a3e858-0b27-4f7c-8aa5-0dfed774177a is missing [ 1.716119] BTRFS error (device sda2): failed to read the system array: -2 [ 1.717021] BTRFS error (device sda2): open_ctree failed [ 1.717599] booster: mount(/dev/sda2): invalid argument [ 1.718186] booster: udev event {Action:remove KObj:/devices/virtual/bdi/btrfs-2 Env:map[ACTION:remove DEVPATH:/devices/virtual/bdi/btrfs-2 SEQNUM:1161 SUBSYSTEM:bdi]} btrfs_test.go:17: Error Trace: /home/anatol/sources/golang/booster/tests/btrfs_test.go:17 Error: Received unexpected error: EOF Test: TestBtrfsRaid0 2023/02/28 17:53:15 Got error while waiting for Qemu process completion: signal: killed --- FAIL: TestBtrfsRaid0 (41.28s) Issue #194
I get the following error (or a variation of it with the other device in the array) after the bootloader:
My systemd-boot entry looks like this:
I have tried setting
universal
in the config, and addingbtrfs
to each of themodules
andmodules_force_load
lists.Output of blkid
fstab
The text was updated successfully, but these errors were encountered: