From nobody Sun Oct 04 19:22:18 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hyXTR3164z6gMkf for ; Sun, 04 Oct 2026 19:22:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hyXTR0ZQNz4FVD for ; Sun, 04 Oct 2026 19:22:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791141739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aabeaDNqeKPnBBCzD99KIpxAN5sQcnVNLUY8dMJkdnw=; b=vNzwBA3gwSgiLEW53BXvNJzbY0emr4gWmAa7EIeuMR2foJra8qhM3ePoncpBFVRpn+UBEf HzYHOZhI/htejMZX221SYebPLsTvgvdxkc+N5uxTukbC4aPH7vASNmhJdmd8vMtuyaBnwk CqU9vOh4gUvazSocxQn6zr0QL68Hx8WL+DsqMfWXzaCqPrDSdAVZ3q4dfYzLGkkPVQspoH EEIBKadSb3Nuv6jZFuT4uQfY85WWOoxEtLjubfz49CsuYwwFJcVMRmaXVfAfrjcw4w6FMu 1Zrai8cniDM74aZUa8ei59i3I9pJ8USj7I3hryfHWTs5tevkhzOhXo/nF08w0g== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791141739; b=tBdRrU5xU2gl14t9PWe0II/pTs+W1D6GxQtyTUbODw2zY+3kWH7cKZNuCCVrAkbOEKFi5I oD8uIp7zvWSX/QEPkOxO5Je5Djht8ePq95z8f9amaiRlwaj4N0aY064wY+YsJ8cVt6tDMT 9gFf1wvg3rM1QeRyJysosY1LSeEJ9jKvHK38JES0wldw/xHLnQhMscBtuJqQYUCbiGeL1U yjY8Nwg8xeBXk2je7P4dIeBrC3t4FPLvepr2BbJg2t6vS3XyZ8dj/giLloj5jXHMmoqDMi mpPSt4EUdvOJI0dU2vVvNbkabB+JvJFpmRdvC7mFj53/7nyjUEdFOkaddXj5Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791141739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aabeaDNqeKPnBBCzD99KIpxAN5sQcnVNLUY8dMJkdnw=; b=I2lppPbg8HH5625vWNSm/HgjtdSlCjSp+/FoG4/aTC/czL1gq+E0GU7A6AJS7qIPD1t6nA KSZZMp2/6Ft8G/e60d0RiBhykVdZkETmmVllz0zhOA/JBwCqm5D2QYugoCSFMx4nFiA4Vt APoHIhh/EAgNBy1GHd52m0a3zVEzW85wMXSAnpUat+IKWRAB3T2ul9ko16D61XIfQe0DqU jCsxMtqSa8AaILXqCj4Xfaqe43pEGyuD7P2PLQjUd6jU1r1B1d8Ig+KNhD1RaGoO5WdWob OoSYBv1eDXbgkvnNYBhTJBTooBrEo3Prb2nOoY6JuwdZxrUo1P9D4ReQQS7jYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hyXTQ6mnwzmx7 for ; Sun, 04 Oct 2026 19:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d5f9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 04 Oct 2026 19:22:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 35b59986b5aa - main - g_part: access leak causes process to hang List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35b59986b5aaedbafefbb79e3da30789ca9aeb24 Auto-Submitted: auto-generated Date: Sun, 04 Oct 2026 19:22:18 +0000 Message-Id: <6ac2a76a.3d5f9.55e8bc71@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=35b59986b5aaedbafefbb79e3da30789ca9aeb24 commit 35b59986b5aaedbafefbb79e3da30789ca9aeb24 Author: Warner Losh AuthorDate: 2026-10-04 19:19:59 +0000 Commit: Warner Losh CommitDate: 2026-10-04 19:21:17 +0000 g_part: access leak causes process to hang So if one inserts a USB drive with a GPT that doesn't match the media size, a resize is initiated, so gpart takes g_access(cp, 1, 1, 1) on the disk and holds it until the resize is accepted or rejected. The orphan path releases it, but the spoil path does not. So if the drive is ejected while the resize is in flight, we call spoil directly, without releasing the access. Since gpt_opened is not cleared for the spoil path, this causes several different process to hang in the open path waiting for the leaked access. Move the release into the wither function when gpt_opened is set, and remove the release elsewhere. Since all paths to destroy the geom pass through wither, this ensure that access is always released when we've taken the access for resize. PR: 297777 Reported by: Rick Richard MFC After: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D59138 --- sys/geom/part/g_part.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 6c4c37d9bfce..cf90429c8643 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -926,7 +926,6 @@ g_part_ctl_commit(struct gctl_req *req, struct g_part_parms *gpp) if (table->gpt_scheme == &g_part_null_scheme) { g_topology_lock(); - g_access(cp, -1, -1, -1); g_part_wither(gp, ENXIO); return (0); } @@ -1080,7 +1079,6 @@ g_part_ctl_create(struct gctl_req *req, struct g_part_parms *gpp) fail: g_topology_lock(); if (null == NULL) { - g_access(cp, -1, -1, -1); g_part_wither(gp, error); } else { kobj_delete((kobj_t)gp->softc, M_GEOM); @@ -1529,7 +1527,6 @@ g_part_ctl_undo(struct gctl_req *req, struct g_part_parms *gpp) error = g_part_probe(gp, cp, table->gpt_depth); if (error) { g_topology_lock(); - g_access(cp, -1, -1, -1); g_part_wither(gp, error); return (0); } @@ -1577,6 +1574,8 @@ g_part_wither(struct g_geom *gp, int error) table = gp->softc; if (table != NULL) { + if (table->gpt_opened) + g_access(LIST_FIRST(&gp->consumer), -1, -1, -1); gp->softc = NULL; while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { LIST_REMOVE(entry, gpe_entry); @@ -2180,18 +2179,14 @@ g_part_resize(struct g_consumer *cp) " Use `gpart commit %s` to save changes or " "`gpart undo %s` to revert them.\n", cp->geom->name, cp->geom->name, cp->geom->name); - if (g_part_check_integrity(table, cp) != 0) { - g_access(cp, -1, -1, -1); - table->gpt_opened = 0; + if (g_part_check_integrity(table, cp) != 0) g_part_wither(table->gpt_gp, ENXIO); - } } static void g_part_orphan(struct g_consumer *cp) { struct g_provider *pp; - struct g_part_table *table; pp = cp->provider; KASSERT(pp != NULL, ("%s", __func__)); @@ -2199,9 +2194,6 @@ g_part_orphan(struct g_consumer *cp) g_topology_assert(); KASSERT(pp->error != 0, ("%s", __func__)); - table = cp->geom->softc; - if (table != NULL && table->gpt_opened) - g_access(cp, -1, -1, -1); g_part_wither(cp->geom, pp->error); }