git: de055556a0d1 - main - libsa/zfs: ignore labels with zero txg

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Wed, 20 Aug 2025 14:53:39 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=de055556a0d18b0523f65fe0d5615723a8b4369b

commit de055556a0d18b0523f65fe0d5615723a8b4369b
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-08-20 14:51:08 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-08-20 14:51:08 +0000

    libsa/zfs: ignore labels with zero txg
    
    Zero txg means this vdev has been correctly removed from the pool.  For
    reference see module/zfs/vdev_removal.c in OpenZFS.  It calls
    vdev_label_init(vd, 0, VDEV_LABEL_REMOVE), and second argument there is
    the txg to write.
    
    Reviewed by:            tsoome, mav, imp
    Differential Revision:  https://reviews.freebsd.org/D51910
---
 stand/libsa/zfs/zfsimpl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
index 0bf232710d7f..4bfb7d4179fb 100644
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -2081,6 +2081,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv,
 
 	if (nvlist_find(nvl, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64,
 	    NULL, &txg, NULL) != 0 ||
+	    txg == 0 ||
 	    nvlist_find(nvl, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64,
 	    NULL, &top_guid, NULL) != 0 ||
 	    nvlist_find(nvl, ZPOOL_CONFIG_POOL_GUID, DATA_TYPE_UINT64,
@@ -2090,7 +2091,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv,
 	    nvlist_find(nvl, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64,
 	    NULL, &guid, NULL) != 0) {
 		/*
-		 * Cache and spare devices end up here - just ignore
+		 * Cache, spare and replaced devices end up here - just ignore
 		 * them.
 		 */
 		nvlist_destroy(nvl);