aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-05-05 09:40:57 -0700
committerBrian Behlendorf <[email protected]>2011-05-05 10:13:38 -0700
commit3613204cd7e3ab1ae658e31dac875e58827a6655 (patch)
tree3bb08220ec1cf1a4e442b36c8ba7303ca8dda39e /cmd
parentc409e4647f221ab724a0bd10c480ac95447203c3 (diff)
Allow mounting of read-only snapshotszfs-0.6.0-rc4
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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mount_zfs/mount_zfs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
index c38ba51c3..e97b2b8a5 100644
--- a/cmd/mount_zfs/mount_zfs.c
+++ b/cmd/mount_zfs/mount_zfs.c
@@ -428,15 +428,20 @@ main(int argc, char **argv)
return (MOUNT_SYSERR);
/* 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 "
"mounted, unable to open the dataset\n"), dataset);
libzfs_fini(g_zfs);
return (MOUNT_USAGE);
}
- (void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, legacy,
- sizeof (legacy), NULL, NULL, 0, B_FALSE);
+ /* 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,
+ sizeof (legacy), NULL, NULL, 0, B_FALSE);
zfs_close(zhp);
libzfs_fini(g_zfs);