]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Some major cleanups.
authorPawel Jakub Dawidek <pjd@FreeBSD.org>
Sun, 19 Dec 2004 23:12:00 +0000 (23:12 +0000)
committerPawel Jakub Dawidek <pjd@FreeBSD.org>
Sun, 19 Dec 2004 23:12:00 +0000 (23:12 +0000)
commit9eec299fab8ff84590fded62cb6bd7103c08d764
tree4b33d8e0ebbb1cb22d588c56f78149b01a56f731
parentc37e2f9bbf5edba2f8a0f77cbc239f75490e225f
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.
sys/geom/mirror/g_mirror.c