HomeFreeBSD

Make mount.zfs(8) calling zfs_mount_at for legacy mounts as well

Description

Make mount.zfs(8) calling zfs_mount_at for legacy mounts as well

Commit 329e2ffa4bca456e65c3db7f5c5c04931c551b61 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 #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'.

An exception however, is when mount.zfs(8) was invoked with '-o remount'
to update the mount options for an existing mount point. In this case
call mount(2) directly without modifying the mount options passed from
command line.

Furthermore, don't run mount.zfs(8) helper for automounting snapshot.
The above change to make mount.zfs(8) to call 'zfs_mount_at'
apparently caused it to trigger an automount for the snapshot
directory. When the helper was invoked as a result of a snapshot
automount, an infinite recursion will occur.

Since the need of invoking user mode mount(8) for automounting was to
overcome that the 'vfs_kern_mount' being GPL-only, just run mount(8)
without the mount.zfs(8) helper by adding option '-i'.

Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: WHR <whr@rivoreo.one>
Closes #16393

Details

Provenance
Low-power <msl0000023508@gmail.com>Authored on Aug 23 2024, 5:39 PM
GitHub <noreply@github.com>Committed on Aug 23 2024, 5:39 PM
Parents
rGcb36f4f35294: zstream recompress: fix zero recompressed buffer and output
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG34118eac06fb: Make mount.zfs(8) calling zfs_mount_at for legacy mounts as well (authored by Low-power <msl0000023508@gmail.com>).Aug 23 2024, 5:39 PM