]> git.proxmox.com Git - zfsonlinux.git/blob - debian/patches/0012-initramfs-use-mount.zfs-instead-of-mount.patch
cherry-pick a few patches from zfs-2.1.7-staging
[zfsonlinux.git] / debian / patches / 0012-initramfs-use-mount.zfs-instead-of-mount.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Damian Szuberski <szuberskidamian@gmail.com>
3 Date: Tue, 12 Apr 2022 00:51:23 +0200
4 Subject: [PATCH] initramfs: use `mount.zfs` instead of `mount`
5
6 A followup to d7a67402a85252e163aa8a9b69e7eda499db8c61
7
8 For `mount -t zfs -o opts ds mp` command line
9 some implementations of `mount(8)`, e. g. Busybox in Debian
10 work as follows:
11
12 ```
13 newfstatat(AT_FDCWD, "ds", 0x7fff826f4ab0, 0) = -1
14 mount("ds", "mp", "zfs", MS_SILENT, NULL) = 0
15 ```
16
17 The logic above skips completely `mount.zfs` and prevents us
18 from reading filesystem properties and applying mount options.
19
20 For comparison, the coreutils `mount(8)` implementation does:
21
22 ```
23 openat(AT_FDCWD, "/proc/filesystems", O_RDONLY|O_CLOEXEC) = 3
24 // figure out that zfs is a `nodev` filesystem and look for a helper
25 newfstatat(AT_FDCWD, "/sbin/mount.zfs" ...) = 0
26 execve("/sbin/mount.zfs" ...) = 0
27 ```
28
29 Using `mount.zfs` in initramfs would help circumvent deficiencies
30 of some of `mount(8)` implementations. `mount -t zfs` translates
31 to `mount.zfs` invocation, except for cases when explicitly disabled
32 by `-i`.
33
34 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
35 Signed-off-by: szubersk <szuberskidamian@gmail.com>
36 Closes #13305
37 (cherry picked from commit 35d81a75a8c13e011e19fd12cf553d9c5849386e)
38 (cherry picked from commit 4d22befde60087cbc6174122863353903df1d935)
39 Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
40 ---
41 contrib/initramfs/scripts/zfs | 6 +++---
42 1 file changed, 3 insertions(+), 3 deletions(-)
43
44 diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs
45 index 814547b6f..9169adf5f 100644
46 --- a/contrib/initramfs/scripts/zfs
47 +++ b/contrib/initramfs/scripts/zfs
48 @@ -326,7 +326,7 @@ mount_fs()
49
50 # Need the _original_ datasets mountpoint!
51 mountpoint=$(get_fs_value "$fs" mountpoint)
52 - ZFS_CMD="mount -o zfsutil -t zfs"
53 + ZFS_CMD="mount.zfs -o zfsutil"
54 if [ "$mountpoint" = "legacy" ] || [ "$mountpoint" = "none" ]; then
55 # Can't use the mountpoint property. Might be one of our
56 # clones. Check the 'org.zol:mountpoint' property set in
57 @@ -349,7 +349,7 @@ mount_fs()
58 # If it's not a legacy filesystem, it can only be a
59 # native one...
60 if [ "$mountpoint" = "legacy" ]; then
61 - ZFS_CMD="mount -t zfs"
62 + ZFS_CMD="mount.zfs"
63 fi
64 fi
65
66 @@ -915,7 +915,7 @@ mountroot()
67 echo " not specified on the kernel command line."
68 echo ""
69 echo "Manually mount the root filesystem on $rootmnt and then exit."
70 - echo "Hint: Try: mount -o zfsutil -t zfs ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
71 + echo "Hint: Try: mount.zfs -o zfsutil ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
72 shell
73 fi
74