Date: Sun, 03 May 2026 15:45:38 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 793be115a029 - stable/15 - geom: Make g_waitidle() wait for orphaned providers Message-ID: <69f76da2.1d841.4af00322@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=793be115a0292878c866752e197afe571e52db8f commit 793be115a0292878c866752e197afe571e52db8f Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-04-09 01:08:45 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-05-03 14:40:10 +0000 geom: Make g_waitidle() wait for orphaned providers This is motivated by the following race in the ZFS zvol code. When a zvol is created, we create a GEOM-backed zvol, which results in a /dev/zvol/<zvol path> device file, created by GEOM::dev. If volmode=dev is specified, zvol_set_volmode_impl() will wither the GEOM, then create a device file with the same name. This sometimes fails because g_wither_geom() is asynchronous, so we end up trying to create a device file while the old one still exists. I want to fix this by adding a g_waitidle() call to zvol_os_remove_minor(). g_waitidle() is not sufficient: GEOM::dev does not destroy the device until g_dev_orphan() is called. (In fact the device destruction is asynchronous too, but the delist_dev() call is sufficient to address this race.) So, I propose modifying g_waitidle() to block until orphaned providers are processed. PR: 258766 Reviewed by: mav, imp, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D55049 (cherry picked from commit 36d971464ac21f6531cb9eaa377f4e1dd915a2ad) --- sys/geom/geom_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index ffd46db55416..34649cea5a71 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -84,7 +84,7 @@ g_waitidle(struct thread *td) mtx_lock(&g_eventlock); TSWAIT("GEOM events"); - while (!TAILQ_EMPTY(&g_events)) + while (!TAILQ_EMPTY(&g_events) || !TAILQ_EMPTY(&g_doorstep)) msleep(&g_pending_events, &g_eventlock, PPAUSE, "g_waitidle", 0); TSUNWAIT("GEOM events");home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f76da2.1d841.4af00322>
