Skip to content

Commit 4d22bef

Browse files
szuberskbehlendorf
authored andcommitted
initramfs: use mount.zfs instead of mount
A followup to d7a6740 For `mount -t zfs -o opts ds mp` command line some implementations of `mount(8)`, e. g. Busybox in Debian work as follows: ``` newfstatat(AT_FDCWD, "ds", 0x7fff826f4ab0, 0) = -1 mount("ds", "mp", "zfs", MS_SILENT, NULL) = 0 ``` The logic above skips completely `mount.zfs` and prevents us from reading filesystem properties and applying mount options. For comparison, the coreutils `mount(8)` implementation does: ``` openat(AT_FDCWD, "/proc/filesystems", O_RDONLY|O_CLOEXEC) = 3 // figure out that zfs is a `nodev` filesystem and look for a helper newfstatat(AT_FDCWD, "/sbin/mount.zfs" ...) = 0 execve("/sbin/mount.zfs" ...) = 0 ``` Using `mount.zfs` in initramfs would help circumvent deficiencies of some of `mount(8)` implementations. `mount -t zfs` translates to `mount.zfs` invocation, except for cases when explicitly disabled by `-i`. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #13305 (cherry picked from commit 35d81a7)
1 parent 6a6bd49 commit 4d22bef

File tree

1 file changed

+3
-3
lines changed
  • contrib/initramfs/scripts

1 file changed

+3
-3
lines changed

contrib/initramfs/scripts/zfs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ mount_fs()
326326

327327
# Need the _original_ datasets mountpoint!
328328
mountpoint=$(get_fs_value "$fs" mountpoint)
329-
ZFS_CMD="mount -o zfsutil -t zfs"
329+
ZFS_CMD="mount.zfs -o zfsutil"
330330
if [ "$mountpoint" = "legacy" ] || [ "$mountpoint" = "none" ]; then
331331
# Can't use the mountpoint property. Might be one of our
332332
# clones. Check the 'org.zol:mountpoint' property set in
@@ -349,7 +349,7 @@ mount_fs()
349349
# If it's not a legacy filesystem, it can only be a
350350
# native one...
351351
if [ "$mountpoint" = "legacy" ]; then
352-
ZFS_CMD="mount -t zfs"
352+
ZFS_CMD="mount.zfs"
353353
fi
354354
fi
355355

@@ -915,7 +915,7 @@ mountroot()
915915
echo " not specified on the kernel command line."
916916
echo ""
917917
echo "Manually mount the root filesystem on $rootmnt and then exit."
918-
echo "Hint: Try: mount -o zfsutil -t zfs ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
918+
echo "Hint: Try: mount.zfs -o zfsutil ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
919919
shell
920920
fi
921921

0 commit comments

Comments
 (0)