Allow mounting of a rootfs dataset with mountpoint=legacy (or anything else besides none) #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first effort to do anything in C, so please bear with me... I tried to understand the logic behind the construction of the mountpoint that gets passed to the zfs mount command, and I believe it to be as follows:
Since sd-zfs handles mounting of descendent filesystems as well, the zfs mountpoint option of the dataset (and its descendents) given to mount.initrd_zfs is appended to the mountpoint given to mount.initrd_zfs. This however breaks mounting the root dataset when its zfs mountpoint is set to anything other than "/", since that path doesn't exist in /new_root inside the initramfs.
This makes it so the dataset given to mount.initrd_zfs is mounted directly to the mountpoint given to mount.initrd_zfs, and treats descendant datasets the same way as they were before.
This helps my dual-boot scenario allowing me to mount the root dataset of Archlinux inside of another distribution (whose rootfs is another dataset in the same pool) without needing to change the zfs mountpoint of the Archlinux dataset from '/' to avoid conflicts with the currently booted dataset. Instead, I just set the Archlinux dataset mountpoint to legacy.