svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs

Toomas Soome tsoome at FreeBSD.org
Sun Nov 3 13:25:48 UTC 2019


Author: tsoome
Date: Sun Nov  3 13:25:47 2019
New Revision: 354283
URL: https://svnweb.freebsd.org/changeset/base/354283

Log:
  loader: we do not support booting from pool with log device
  
  If pool has log device, stop there and tell about it.

Modified:
  head/stand/libsa/zfs/zfs.c
  head/stand/libsa/zfs/zfsimpl.c
  head/sys/cddl/boot/zfs/zfsimpl.h

Modified: head/stand/libsa/zfs/zfs.c
==============================================================================
--- head/stand/libsa/zfs/zfs.c	Sun Nov  3 13:03:47 2019	(r354282)
+++ head/stand/libsa/zfs/zfs.c	Sun Nov  3 13:25:47 2019	(r354283)
@@ -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);

Modified: head/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- head/stand/libsa/zfs/zfsimpl.c	Sun Nov  3 13:03:47 2019	(r354282)
+++ head/stand/libsa/zfs/zfsimpl.c	Sun Nov  3 13:25:47 2019	(r354283)
@@ -1109,6 +1109,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde
 	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, vde
 	}
 
 	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, vde
 				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);
@@ -1737,6 +1748,12 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s
 		printf("ZFS: inconsistent nvlist contents\n");
 		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.

Modified: head/sys/cddl/boot/zfs/zfsimpl.h
==============================================================================
--- head/sys/cddl/boot/zfs/zfsimpl.h	Sun Nov  3 13:03:47 2019	(r354282)
+++ head/sys/cddl/boot/zfs/zfsimpl.h	Sun Nov  3 13:25:47 2019	(r354283)
@@ -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. */


More information about the svn-src-all mailing list