-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add function to check if a BTRFS volume is complete #244
Comments
@cmurf, I'm trying to work on this with no success. I've created a RAID0 (data) btrfs volume on two loop devices and it's a mystery to me how to determine if the volume has all devices or not. With just one of the loop devices setup I'm getting this:
There seems to be nothing relevant to this issue under Any ideas? |
Yes, it's confusing for me as well. Here are some breadcrumbs.
/usr/lib/udev/rules.d/64-btrfs.rules I think ends up calling When I strace |
I'm afraid we are not able to resolve this issue now. |
What additional information is needed? Is there something upstream needs to provide or explain? |
Well, your previous comment (#244 (comment)) sounds to me like we have no option to do what this issue is about. If I understand it correctly, we would have to try to mount the volume, right? |
systemd-udev already has a wrapper for this in src/udev/udev-builtin-btrfs.c which is then used by rules/64-btrfs.rules. If a 2 device Btrfs volume is used for rootfs, this rule causes a hang during startup until both devices are found, systemd won't even try to mount until all devices are ready per this rule. So my question is why this udev rule doesn't also inhibit udisksd from trying to mount a Btrfs volume until all devices are ready. If you just want information about a volume's members without mounting, that's Also the problem of udisksd trying to mount an unready volume (individually trying to mount member devices as udisksd sees them appear) is not a big deal, it just results in the generic open_ctree error. The real problem is when asking e.g. in GUI, to umount multiple device Btrfs, udisks gets really confused, does not properly umount the filesystem before it starts deleting device nodes, and the result is fs corruption. https://bugs.freedesktop.org/show_bug.cgi?id=87277#c3 |
Yes, but it doesn't seem to work as we expect/need. Here's the example from a shell with RAID1 (both data and metadata) btrfs volume on
(Also interesting that it's impossible to mount a RAID1 volume without the second disk, btw) The only thing that seems to provide some useful data is:
except that it, of course (sarcasm), exits with code |
The user space command doesn't seem to work as anyone expects, so I'm kinda beating up on upstream about what's going on because the ioctl does work as intended within the udev wrapper.
It requires
I expect only exit 0 from this command, or there's a bug. I'd sarcastically sooner expect a crash than non-zero. |
OK that upstream thread has been updated, and now I understand. Our tests are flawed due to misunderstanding how the devices_ready ioctl works. Once the kernel sees all devices, The kernel does not forget even if all devices are removed. If I re-add one of the devices, |
Funny story this one... Anyway, I take it the only reliable way to see if all devices from a volume are present is to use |
If mounting normally succeeds, by definition all devices are present. There's no harm in trying, but if they aren't all present, you get a generic mount failure message and therefore the failure reason is uncertain. Otherwise, yes, and I'd say it's not worth doing the work to parse the output until something like this happens to unify the tools: |
If BTRFS volume uses multiple devices, it's not easy for the user-space code (e.g. UDisks2) to determine if all the used devices are present in the system or not. There are ways to check it, but no API/library function. libblockdev-btrfs should cover this.
See also storaged-project/udisks#88
The text was updated successfully, but these errors were encountered: