mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-03-03 19:28:18 +03:00
Allow mounting of read-only snapshots
With the addition of the mount helper we accidentally regressed the ability to manually mount snapshots. This commit updates the mount helper to expect the possibility of a ZFS_TYPE_SNAPSHOT. All snapshot will be automatically treated as 'legacy' type mounts so they can be mounted manually.
This commit is contained in:
parent
c409e4647f
commit
3613204cd7
@ -428,13 +428,18 @@ main(int argc, char **argv)
|
|||||||
return (MOUNT_SYSERR);
|
return (MOUNT_SYSERR);
|
||||||
|
|
||||||
/* try to open the dataset to access the mount point */
|
/* try to open the dataset to access the mount point */
|
||||||
if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_FILESYSTEM)) == NULL) {
|
if ((zhp = zfs_open(g_zfs, dataset,
|
||||||
|
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT)) == NULL) {
|
||||||
(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
|
(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
|
||||||
"mounted, unable to open the dataset\n"), dataset);
|
"mounted, unable to open the dataset\n"), dataset);
|
||||||
libzfs_fini(g_zfs);
|
libzfs_fini(g_zfs);
|
||||||
return (MOUNT_USAGE);
|
return (MOUNT_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* treat all snapshots as legacy mount points */
|
||||||
|
if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT)
|
||||||
|
(void) strlcpy(legacy, ZFS_MOUNTPOINT_LEGACY, ZFS_MAXPROPLEN);
|
||||||
|
else
|
||||||
(void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, legacy,
|
(void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, legacy,
|
||||||
sizeof (legacy), NULL, NULL, 0, B_FALSE);
|
sizeof (legacy), NULL, NULL, 0, B_FALSE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user