loader: we do not support booting from pool with log device

If pool has log device, stop there and tell about it.
This commit is contained in:
Toomas Soome 2019-11-03 13:25:47 +00:00
parent f4ed004573
commit 0c0a882c7a
3 changed files with 29 additions and 5 deletions

View File

@ -668,6 +668,11 @@ zfs_dev_open(struct open_file *f, ...)
spa = spa_find_by_guid(dev->pool_guid);
if (!spa)
return (ENXIO);
if (spa->spa_with_log) {
printf("Reading pool %s is not supported due to log device.\n",
spa->spa_name);
return (ENXIO);
}
mount = malloc(sizeof(*mount));
if (mount == NULL)
return (ENOMEM);

View File

@ -1109,6 +1109,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
const unsigned char *kids;
int nkids, i, is_new;
uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_present;
uint64_t is_log;
if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64,
NULL, &guid)
@ -1132,17 +1133,20 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
}
is_offline = is_removed = is_faulted = is_degraded = isnt_present = 0;
is_log = 0;
nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, NULL,
&is_offline);
&is_offline);
nvlist_find(nvlist, ZPOOL_CONFIG_REMOVED, DATA_TYPE_UINT64, NULL,
&is_removed);
&is_removed);
nvlist_find(nvlist, ZPOOL_CONFIG_FAULTED, DATA_TYPE_UINT64, NULL,
&is_faulted);
&is_faulted);
nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, NULL,
&is_degraded);
&is_degraded);
nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, NULL,
&isnt_present);
&isnt_present);
nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, NULL,
&is_log);
vdev = vdev_find(guid);
if (!vdev) {
@ -1217,6 +1221,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
return (ENOMEM);
vdev->v_name = name;
}
vdev->v_islog = is_log == 1;
} else {
is_new = 0;
}
@ -1433,6 +1438,12 @@ vdev_status(vdev_t *vdev, int indent)
{
vdev_t *kid;
int ret;
if (vdev->v_islog) {
(void)pager_output(" logs\n");
indent++;
}
ret = print_state(indent, vdev->v_name, vdev->v_state);
if (ret != 0)
return (ret);
@ -1738,6 +1749,12 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap)
return (EIO);
}
/*
* We do not support reading pools with log device.
*/
if (vdev->v_islog)
spa->spa_with_log = vdev->v_islog;
/*
* Re-evaluate top-level vdev state.
*/

View File

@ -1670,6 +1670,7 @@ typedef struct vdev {
vdev_phys_read_t *v_phys_read; /* read from raw leaf vdev */
vdev_read_t *v_read; /* read from vdev */
void *v_read_priv; /* private data for read function */
boolean_t v_islog;
struct spa *spa; /* link to spa */
/*
* Values stored in the config for an indirect or removing vdev.
@ -1694,6 +1695,7 @@ typedef struct spa {
zio_cksum_salt_t spa_cksum_salt; /* secret salt for cksum */
void *spa_cksum_tmpls[ZIO_CHECKSUM_FUNCTIONS];
int spa_inited; /* initialized */
boolean_t spa_with_log; /* this pool has log */
} spa_t;
/* IO related arguments. */