Commit Graph

50 Commits

Author SHA1 Message Date
phk
042d10f8ef Make withering water tight.
When we orphan/wither a provider, an attached geom+consumer could
end up being withered as a result and it may be in front of us in
the normal object scanning order so we need to do multi-pass.  On
the other hand, there may be withering stuff we can't get rid off
(yet), so we need to keep track of both the existence of withering
stuff and if there is more we can do at this time.
2004-07-08 16:17:14 +00:00
phk
9a7074f4cb Rearrange some of the GEOM debugging tools to be more structured.
Retire g_sanity() and corresponding debugflag (0x8)

  Retire g_{stall,release}_events().

  Under #ifdef DIAGNOSTIC:

    Make g_valid_obj() an official function and have it return an an
    non-zero integer which indicates the kind of object when found.

    Implement G_VALID_{CLASS,GEOM,CONSUMER,PROVIDER}() macros based
    on g_valid_obj().

    Sprinkle calls to these macros liberally over the infrastructure.

    Always check that we do not free a live object.
2004-03-10 08:49:08 +00:00
pjd
1af94a8033 Now we have g_topology_assert_not(), so use it to detect deadlocks.
Approved by:	phk, scottl (mentor)
2004-02-10 15:55:17 +00:00
phk
98a9a50f22 Don't mingle malloc/g_event flags.
Spotted by:	pjd@
2004-02-02 10:58:07 +00:00
phk
0592926b47 Make sure to keep track of canceled events.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:09:38 +00:00
phk
fe692735bf Prevent withering of the provider we're orphaning from happening until
we do it ourselves.

Nailed by:	Simon Heath <heath@cng.fr>
2003-12-23 11:37:05 +00:00
phk
888f0e51c6 KASSERT against multiple orphanings of providers. 2003-12-07 10:04:43 +00:00
phk
aeb3231da5 Fix a harmless bug and add a ')' in a debugging printf.
Submitted by: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
2003-11-18 07:54:12 +00:00
phk
ed350390ed Destroy providers maked with G_PF_WITHER when the last consumer has detached. 2003-10-12 11:34:35 +00:00
obrien
40ee2bd5c8 Use __FBSDID().
Approved by:	phk
2003-06-11 06:49:16 +00:00
phk
69b4e9ce01 Add missing va_end() calls.
Noticed by:	tmm
2003-06-07 10:16:53 +00:00
phk
a49f8acd23 Get rid of trivial function g_destroy_event(). 2003-05-02 05:26:19 +00:00
phk
26e81abf93 Add a new flag, EV_CANCELED, and use it to make g_waitfor_event() return
EAGAIN if an event got canceled.
2003-05-01 19:43:52 +00:00
phk
2ae9241429 When events on a reference is cancelled, check our doorstep first,
it might be an orphan.
2003-05-01 19:24:00 +00:00
phk
ffd04bfbdd Introduce a g_waitfor_event() function which posts an event and waits for
it to be run (or cancelled) and use this instead of home-rolled versions.
2003-04-23 21:28:27 +00:00
phk
7a7d406136 More of the event stuff can now be private to geom_event.c 2003-04-23 20:54:42 +00:00
phk
3bbfe9f43b Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.
2003-04-23 20:46:12 +00:00
phk
b4c26d2e1a Remove the now unused hardcoded g_post_event() event support. 2003-04-23 20:25:33 +00:00
phk
7c462ceb2b Turn EV_NEW_PROVIDER into a g_call_me() event. 2003-04-23 20:16:13 +00:00
phk
67a31a6107 Convert EV_SPOILED event to use g_call_me(). 2003-04-23 20:06:38 +00:00
phk
16bcc257a6 Turn the hardwired NEW_CLASS event into a g_call_me() event. 2003-04-23 19:34:38 +00:00
phk
51e68a1f27 Move the shutdown eventhandler stuff to a more logical place. 2003-04-23 19:15:27 +00:00
phk
03b1ca36ba Time has run from the "run GEOM in userland" harness, and the new regression
test is built to test GEOM as running in the kernel.

This commit is basically "unifdef -D_KERNEL" to remove the mainly #include
related code to support the userland-harness.
2003-04-13 09:02:06 +00:00
phk
bef7fcb806 Fix a bug which resulted in orphanization getting confused every now
and then.
2003-04-12 16:36:19 +00:00
phk
39cbb43bab Add handling for cancelled events in the g_call_me() methods. 2003-04-02 21:10:04 +00:00
phk
cedf04c475 Change events to have an array of "void *" references, and give the
event posting functions varargs to fill these.

Attribute g_call_me() to appropriate g_geom's where necessary.

Add a flag argument to g_call_me() methods which will be used to signal
cancellation of events in the future.

This commit should be a no-op.
2003-04-02 20:41:18 +00:00
phk
dc9d8429c2 Save a lock: Grab the stall_events SX lock exclusively so it also serialize
OAM reqests.
2003-03-24 13:35:06 +00:00
phk
8e76f1cefa Introduce g_cancel_events() and use it a couple of places where it makes
sense.
2003-03-23 23:01:40 +00:00
phk
3e8d794231 Introduce an SX lock which allows us to stall event processing
during OAM operations.
2003-03-23 21:58:09 +00:00
phk
127bfb5486 #ifdef notyet a bit of code which needs not yet committed refcounting to
work correctly.
2003-03-16 16:29:04 +00:00
phk
29e1315705 If we run out of consumers while orphaning them, and the provider's geom
is withering, destroy the provider when done.

This was exposed by the recent change to geom_dev's orphaning logic.
2003-03-10 23:41:41 +00:00
phk
8da8aa2622 Stamp out Danglish. 2003-03-09 10:02:31 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
alfred
bf8e8a6e8f Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
phk
6ef829cd7d Remove g_silence(). It does not do anything anymore. 2003-01-13 08:46:32 +00:00
phk
a500538d00 Polish a bit here and there.
Reenable the geom.ctl device so people can play with gbde.

Sponsored by:	DARPA & NAI Labs
2002-11-04 09:31:02 +00:00
phk
23e3bcb405 Make sure we don't loose our topology lock in a call_me() handler.
Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:27:29 +00:00
phk
83aec680cb Implement g_call_me() as a way for geom methods to schedule operations
to be performed in the event-thread.

To do this, we need to lock the eventlist with g_eventlock (nee g_doorlock),
since g_call_me() being called from the UP/DOWN paths will not be able to
aquire g_topology_lock.

This also means that for now these events are not referenced on any
particular consumer/provider/geom.

For UP/DOWN path use, this will not become a problem since the access()
function will make sure we drain any bio's before we dismantle.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 20:38:36 +00:00
phk
a09a7e0aa7 Ok, include also the two tests which actually does effect the claims
of the last commit message.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:30:27 +00:00
phk
85fb4b0590 Hook into the shutdown EVENTHANDLER and stop tasting things after we
get notified to make things settle a bit faster.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:23:35 +00:00
phk
582654c687 Rename the doorlock to eventlock, it gets to protect a bit more in the future.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:18:16 +00:00
phk
411db1de5a Improve some on the naming.
Submitted by:	iedowse
2002-06-09 10:57:34 +00:00
phk
8bb89b7b0c Only clear the spoiled flag if the class had no spoiled method, the spoiled
method may have deallocated the consumer already and modifying free()'ed
memory is bad style.

Sponsored by: DARPA & NAI Labs.
2002-05-26 17:17:25 +00:00
phk
0d0d0abc10 Don't grab Giant around malloc(9) and free(9).
Don't grab Giant around wakeup(9).
Don't print verbose messages about each device found in geom_dev.
Various cleanups.

Sponsored by: DARPA & NAI Labs.
2002-05-20 10:03:15 +00:00
jhb
db9aa81e23 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
phk
fd177bc959 Move access and orphan member functions from class to geom.
Sponsored by: DARPA & NAI Labs
2002-04-04 09:54:13 +00:00
phk
46a753d1ac s/classs/classes/ to fixup grammer after the previous global renaming.
Sponsored by: DARPA & NAI Labs
2002-04-04 09:41:47 +00:00
phk
aeded84143 Eliminate some thread pointers which do not make sense anymore.
Split private parts of geom.h into geom_int.h.  The latter should
never be included in class implemtations.
2002-03-26 22:07:38 +00:00
phk
1af8cfb2f2 Cave in to tradition and rename "methods" to "classes". 2002-03-26 21:40:06 +00:00
phk
3e53a43775 First commit of the GEOM subsystem to make it easier for people to
test and play with this.

This is not yet production quality and should be run only on dedicated
test boxes.

For people who want to develop transformations for GEOM there exist a
set of shims to run geom in userland (ask phk@freebsd.org).

Reports of all kinds to: phk@freebsd.org
Please include in report:
        dmesg
        sysctl debug.geomdot
        sysctl debug.geomconf

Known significant limitations:
        no kernel dump facility.
        ioctls severely restricted.

Sponsored by:   DARPA, NAI Labs
2002-03-11 21:42:35 +00:00