summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2021-03-02 20:53:51 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2021-03-04 13:43:36 +0000
commitcd12acafe1f95ec0f3308baba673d2653990a014 (patch)
tree24387f7feadefaf158d0fe8095add1fc61204faa
parent6ed464ecaed26b9c4fc83c9edf03813e1c37c7e7 (diff)
downloadillumos-joyent-cd12acafe1f95ec0f3308baba673d2653990a014.tar.gz
2766 zoneadm install fails with root of zpool not mounted
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Robert French <robert@robertdfrench.me> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
-rw-r--r--usr/src/cmd/zoneadm/zfs.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr/src/cmd/zoneadm/zfs.c b/usr/src/cmd/zoneadm/zfs.c
index 15be33ddab..b261504336 100644
--- a/usr/src/cmd/zoneadm/zfs.c
+++ b/usr/src/cmd/zoneadm/zfs.c
@@ -24,6 +24,7 @@
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2016 Martin Matuska. All rights reserved.
+ * Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
*/
/*
@@ -88,18 +89,23 @@ match_mountpoint(zfs_handle_t *zhp, void *data)
return (0);
}
- /* First check if the dataset is mounted. */
+ /*
+ * First check if the dataset is mounted.
+ * If not, move on to iterating child datasets which may still be
+ * mounted.
+ */
if (zfs_prop_get(zhp, ZFS_PROP_MOUNTED, mp, sizeof (mp), NULL, NULL,
0, B_FALSE) != 0 || strcmp(mp, "no") == 0) {
- zfs_close(zhp);
- return (0);
+ goto children;
}
- /* Now check mount point. */
+ /*
+ * Now check mount point.
+ * Move on to children if it cannot be retrieved.
+ */
if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mp, sizeof (mp), NULL, NULL,
0, B_FALSE) != 0) {
- zfs_close(zhp);
- return (0);
+ goto children;
}
cbp = (zfs_mount_data_t *)data;
@@ -134,6 +140,7 @@ match_mountpoint(zfs_handle_t *zhp, void *data)
return (1);
}
+children:
/* Iterate over any nested datasets. */
res = zfs_iter_filesystems(zhp, match_mountpoint, data);
zfs_close(zhp);