Make mount.zfs(8) calling zfs_mount_at for legacy mounts as well
Commit 329e2ffa4b
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.
Signed-off-by: WHR <whr@rivoreo.one>
This commit is contained in:
parent
816d2b2bfc
commit
b50ae96744
|
@ -269,8 +269,7 @@ main(int argc, char **argv)
|
||||||
return (MOUNT_USAGE);
|
return (MOUNT_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zfsutil || sloppy ||
|
if (sloppy || libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
|
||||||
libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
|
|
||||||
zfs_adjust_mount_options(zhp, mntpoint, mntopts, mtabopt);
|
zfs_adjust_mount_options(zhp, mntpoint, mntopts, mtabopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +336,7 @@ main(int argc, char **argv)
|
||||||
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);
|
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);
|
||||||
|
|
||||||
if (!fake) {
|
if (!fake) {
|
||||||
if (zfsutil && !sloppy &&
|
if (!remount && !sloppy &&
|
||||||
!libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
|
!libzfs_envvar_is_set("ZFS_MOUNT_HELPER")) {
|
||||||
error = zfs_mount_at(zhp, mntopts, mntflags, mntpoint);
|
error = zfs_mount_at(zhp, mntopts, mntflags, mntpoint);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in New Issue