Bug 200740 - work around KASSERT panic due to race between GEOM tasting and withering
Summary: work around KASSERT panic due to race between GEOM tasting and withering
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-geom (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-06-09 18:57 UTC by Scott M. Ferris
Modified: 2024-01-24 06:29 UTC (History)
4 users (show)

See Also:


Attachments
wither-taste.diff (524 bytes, patch)
2015-06-09 18:57 UTC, Scott M. Ferris
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott M. Ferris 2015-06-09 18:57:32 UTC
Created attachment 157577 [details]
wither-taste.diff

disk_gone() can happen at any time due to hardware failures, and start withering GEOM devices.  If something closes a device at about the same time, g_access() can queue an event that will call g_new_provider_event(), and the provider may have G_PF_WITHER set by the time g_new_provider_event() gets called, which panics a debug kernel.

The attached patch replaces the KASSERT with a check of G_PF_WITHER, and just returns if it's set, since it doesn't make sense to taste a device that's going away.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2015-07-03 08:22:49 UTC
I once wrote the following patch:
http://thread.gmane.org/gmane.os.freebsd.devel.geom/5280
but never committed it.
I wonder if the patch would help here as well.
Could you please test?

P.S. If you have any problem adapting the patch to the current code please let me know and I will do it.
Comment 2 Graham Perrin 2024-01-24 06:29:26 UTC
See also: 

<https://codeberg.org/grahamperrin/freebsd-src/issues/5>

> #5 - Kernel panic: g_resize_provider_event but withered 
> - grahamperrin/freebsd-src - Codeberg.org