-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 all read-only compatible features to GRUB2 compatibility feature set #14675
Conversation
b1f1135
to
583ebc6
Compare
I don't actually think you can do that. I haven't personally tested this, but I know there were reports at least at one point that some of the read-only compatible features caused grub to burp and error out unexpectedly anyway, so I'd test that that's no longer true on pools with them all active before adding them. |
Are you sure? I just enabled all these features except Or do the features actually need to be
|
enabled just means "we're allowed to be using it, but we're not, yet", while active means "we actually wrote things with this incompatibility on the pool", and I think the latter was what made grub grumpy. I'd be perfectly happy if I'm wrong and this is not an issue, but I seem to recall reports of GRUB complaining about one or two read-only features it shouldn't mind showing up, so I'd like to confirm that's not a thing that comes up somewhat before saying I think this is a fine plan. (I'll go try to dig out more concrete information later, so this isn't just "some guy I met once said it broke".) |
You should test Overall, I'd be happy if they are truly work, but we should test full cycle. And interesting point that some grubs (at least in opensuse) may have more problems with new features, unfortunately I didn't have time to bisect their source for a reason. |
Since GRUB2 opens pools in read-only mode, all read-only compatible features, which don't have a dependency on an incompatible feature can be enabled. Several read-only compatible features have been introduced since the GRUB2 compatibility file was created but the file wasn't updated. I added all features from `zpool_feature_init()` in `module/zcommon/zfeature_common.c` where the `ZFEATURE_FLAG_READONLY_COMPAT` flag is set and which don't depend on an incompatible feature. Signed-off-by: Luflosi <luflosi@luflosi.de>
583ebc6
to
9e5794a
Compare
I accidentally added the read-only compatible feature I'm trying to get all the features to be "active" instead of "enabled" in the VM test. I don't know how to make the features |
It looks like, to get |
My VM test only works with Linux. Is the unmerged code to enable
That sounds prone to race conditions. Is there a way that I can test this in a reliable way? On a similar note, is there a reliable way I can test the I think I have activated all other newly added features except |
I mean, the feature is literally only active when there's pending ZIL data on a dataset, so I think the best you'd get would be plumbing a knob somewhere to force it to not flush in a timely fashion to make the window deterministic, unless someone already has tooling for it I'm not aware of.
e: I have a branch I was playing with it in that should suffice for just getting the feature activated, but it's just an experiment, there are known explosions if you touch complicated things, etc. So just using it to generate a test pool is probably best. |
I ran the latest ZFS master version aebd94c with rincebrain@fd21c46 applied as a patch. "flock /dev/vda parted --script /dev/vda -- mklabel msdos"
+ " mkpart primary ext2 1M 256MB" # /boot
+ " mkpart primary ext2 256MB 512MB" # /boot special metadata device
+ " mkpart primary linux-swap 512MB 1536M"
+ " mkpart primary ext2 1536M -1s", # /
"udevadm settle",
"mkswap /dev/vda3 -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/vda4",
"mount LABEL=nixos /mnt",
# Use as many ZFS features as possible to verify that GRUB can handle them
"zpool create -o compatibility=grub2 -O utf8only=on -O normalization=formD bpool /dev/vda1",
"zpool add bpool -o ashift=12 special /dev/vda2",
"zfs create -o recordsize=1M -o mountpoint=legacy -o compression=lz4 -o xattr=sa -o acltype=posixacl -o relatime=on bpool/boot",
# Snapshotting the top-level dataset would trigger a bug in GRUB2: https://github.com/openzfs/zfs/issues/13873
"zfs snapshot bpool/boot@snap-1",
"zfs clone bpool/boot@snap-1 bpool/test",
"zpool checkpoint bpool",
"mkdir -p /mnt/boot",
"mount -t zfs bpool/boot /mnt/boot",
"touch /mnt/boot/test",
"setfattr -n user.comment -v 'this is a comment' /mnt/boot/test",
"cp --reflink=always /mnt/boot/test /mnt/boot/test2",
"sleep 10", # TODO: remove
"zpool status >&2",
# Print out all enabled and active ZFS features (and some other stuff)
"zpool get all bpool >&2",
# Abort early if GRUB2 doesn't like the disks
"grub-probe --target=device /mnt/boot >&2", This is python code with strings containing bash code.
|
I wouldn't be astonished if I screwed up activating the feature, though I would have expected the clone calls to do it. Curious. Yeah, there's debug prints, it's very much a debug toy build. You could probably use |
I have never used the |
In ubuntu we have to patch tooling to prevent accidental upgrade of the "bpool" which are trying to keep grub compatible. It would be nice if we could have a pool featureflag for grub compat, and thus prevent pool upgrades and/or enabling features outside of the grub-compatible one. Similarly testing should be done in against grub's supported available and active features. |
Motivation and Context
Since GRUB2 opens pools in read-only mode, all read-only compatible features can be enabled.
Description
Several read-only compatible features have been introduced since the GRUB2 compatibility file was created but the file wasn't updated.
I added all features from
zpool_feature_init()
inmodule/zcommon/zfeature_common.c
where theZFEATURE_FLAG_READONLY_COMPAT
flag is set.This is my first PR here, so please excuse any mistakes I may have made.
How Has This Been Tested?
I created a ZFS pool with
-o compatibility=grub2
used it as /boot and successfully booted from the pool using GRUB2. To make this easy and reproducible, I wrote a NixOS VM test, which I plan to upstream to Nixpkgs. I'll happily provide more details about this if requested.Types of changes
Checklist:
Signed-off-by
.