Skip to content

Commit

Permalink
Make mount.zfs(8) calling zfs_mount_at for legacy mounts as well
Browse files Browse the repository at this point in the history
Commit 329e2ff has made mount.zfs(8) to
call libzfs function 'zfs_mount_at', in order to propagate dataset
properties into mount options. This fix however, is limited to a special
use case where mount.zfs(8) is used in initrd with option '-o zfsutil'.
If either initrd or the user need to use mount.zfs(8) to mount a file
system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and
the original issue openzfs#7947 will still happen.

Since the existing code already excluded the possibility of calling
'zfs_mount_at' when it was invoked as a helper program from zfs(8), by
checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to
avoid calling 'zfs_mount_at' without '-o zfsutil'.

Signed-off-by: WHR <whr@rivoreo.one>
  • Loading branch information
Low-power committed Jul 28, 2024
1 parent 62e7d3c commit 6b7aa6a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cmd/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ main(int argc, char **argv)
return (MOUNT_USAGE);
}

if (!zfsutil || sloppy ||
libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
if (sloppy || libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
zfs_adjust_mount_options(zhp, mntpoint, mntopts, mtabopt);
}

Expand Down Expand Up @@ -337,8 +336,7 @@ main(int argc, char **argv)
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);

if (!fake) {
if (zfsutil && !sloppy &&
!libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
if (!sloppy && !libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
error = zfs_mount_at(zhp, mntopts, mntflags, mntpoint);
if (error) {
(void) fprintf(stderr, "zfs_mount_at() failed: "
Expand Down

0 comments on commit 6b7aa6a

Please sign in to comment.