cvs commit: src/sys/geom/mirror g_mirror.c
Pawel Jakub Dawidek
pjd at FreeBSD.org
Sun Dec 19 15:12:01 PST 2004
pjd 2004-12-19 23:12:00 UTC
FreeBSD src repository
Modified files:
sys/geom/mirror g_mirror.c
Log:
Some major cleanups.
Keeping consumers open when device is closed is very hard. We need to
open consumers sometimes to update metadata, etc.
Many hacks was introduced in the past to made it possible. You cannot
be sure that you can open consumer for writing always, even if you think
it should be allowed. If one of the mirror components is for example da0
and you try to open it, you can get EPERM when da0s1 is opened for reading
(because BSD class opens consumers (da0) with an extra 'e' bit set).
Waiting for the events queue to be empty may do the trick, but it makes
code much uglier (as you cannot always call g_waitidle()), it doesn't
solve all edge cases and it can introduce deadlocks if there are events
in the queue that wait for gmirror.
I removed those hacks. Now all consumers are open r1w1e1 always, even if
device is closed. Maybe it is less clean from GEOM perspective, but simpify
code a lot and make it much more reliable.
The only issue was retaste event which is sent when we close consumers
opened for writing. I ignore retaste event by not detaching consumer
immediately (so retaste event is not send to my class) and sending event
right after it to detach and destroy consumer.
Revision Changes Path
1.48 +107 -175 src/sys/geom/mirror/g_mirror.c
More information about the cvs-src
mailing list