Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 2020 21:21:35 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362663 - head/stand/libsa/zfs
Message-ID:  <202006262121.05QLLZ8R041056@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Fri Jun 26 21:21:35 2020
New Revision: 362663
URL: https://svnweb.freebsd.org/changeset/base/362663

Log:
  loader: can not read zfs pool with slog removed
  
  The vdev_init() does check for "known" vdev types, the [log] device removal will create "hole"
  device, but vdev_init() does not allow it.
  
  Obtained from: illumos
  MFC after:	1 week

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- head/stand/libsa/zfs/zfsimpl.c	Fri Jun 26 20:44:10 2020	(r362662)
+++ head/stand/libsa/zfs/zfsimpl.c	Fri Jun 26 21:21:35 2020	(r362663)
@@ -765,7 +765,14 @@ vdev_disk_read(vdev_t *vdev, const blkptr_t *bp, void 
 	    offset + VDEV_LABEL_START_SIZE, bytes));
 }
 
+static int
+vdev_missing_read(vdev_t *vdev __unused, const blkptr_t *bp __unused,
+    void *buf __unused, off_t offset __unused, size_t bytes __unused)
+{
 
+	return (ENOTSUP);
+}
+
 static int
 vdev_mirror_read(vdev_t *vdev, const blkptr_t *bp, void *buf,
     off_t offset, size_t bytes)
@@ -904,9 +911,10 @@ vdev_init(uint64_t guid, const nvlist_t *nvlist, vdev_
 #endif
 	    memcmp(type, VDEV_TYPE_RAIDZ, len) != 0 &&
 	    memcmp(type, VDEV_TYPE_INDIRECT, len) != 0 &&
-	    memcmp(type, VDEV_TYPE_REPLACING, len) != 0) {
+	    memcmp(type, VDEV_TYPE_REPLACING, len) != 0 &&
+	    memcmp(type, VDEV_TYPE_HOLE, len) != 0) {
 		printf("ZFS: can only boot from disk, mirror, raidz1, "
-		    "raidz2 and raidz3 vdevs\n");
+		    "raidz2 and raidz3 vdevs, got: %.*s\n", len, type);
 		return (EIO);
 	}
 
@@ -937,6 +945,8 @@ vdev_init(uint64_t guid, const nvlist_t *nvlist, vdev_
 			    DATA_TYPE_UINT64,
 			    NULL, &vic->vic_prev_indirect_vdev, NULL);
 		}
+	} else if (memcmp(type, VDEV_TYPE_HOLE, len) == 0) {
+		vdev = vdev_create(guid, vdev_missing_read);
 	} else {
 		vdev = vdev_create(guid, vdev_disk_read);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006262121.05QLLZ8R041056>