FreeBSD: Do not leak TSD zfs_geom_probe_vdev_key on errors

If there is an error early in `vdev_geom_open()`, the thread will leak
`zfs_geom_probe_vdev_key`, causing every `zvol_geom_open()` in the
thread to return `EOPNOTSUPP`. The purpose of `zfs_geom_probe_vdev_key`
is to prevent recursion into `vdev_geom_open()`, not inhibit it
permanently, so we modify `vdev_geom_open()` to set it after the error
checks.

Reported-by: Grok 4.5 Build Beta

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #18927
This commit is contained in:
Richard Yao authored and GitHub committed 2026-08-17 09:26:59 -04:00
1 parent b92a220b95
commit be55e01bc0
1 file changed
+7 -6
+7 -6
View File
@@ -800,12 +800,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
int error, has_trim;
uint16_t rate;
/*
* Set the TLS to indicate downstack that we
* should not access zvols
*/
VERIFY0(tsd_set(zfs_geom_probe_vdev_key, vd));
/*
* We must have a pathname, and it must be absolute.
*/
@@ -823,6 +817,13 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
goto skip_open;
}
/*
* Set the TLS to indicate downstack that we
* should not access zvols
*/
VERIFY0(tsd_set(zfs_geom_probe_vdev_key, vd));
DROP_GIANT();
g_topology_lock();
error = 0;