]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
When orphaning a provider, cancel events related to it.
authorPawel Jakub Dawidek <pjd@FreeBSD.org>
Thu, 27 Sep 2007 20:18:34 +0000 (20:18 +0000)
committerPawel Jakub Dawidek <pjd@FreeBSD.org>
Thu, 27 Sep 2007 20:18:34 +0000 (20:18 +0000)
commit3ea5d7ec245a33f49532acfbc716707aea697aa4
treeb3d990f8b67f26c454fa3bce08c11a3c74f45c42
parent3b2f6b3a4b490d864e4557b8ff72eeb98aa4571f
When orphaning a provider, cancel events related to it.
Without this change the following situation was possible:

1. Provider is orphaned from within class' access() method on last write
   close - orphan provider event is send.
2. GEOM detects last write close on a provider and sends new provider event.
3. g_orphan_register() is called, and calls all orphan methods of attached
   consumers.
4. New provider event is executed on orphaned provider, all classes can
   taste already orphaned provider, and some may attach consumers to it.
   Those consumers will never go away, because the g_orphan_register()
   was already called.

We end up with a zombie provider.

With this change, at step 3, we will cancel new provider event.

How to repeat this problem:

# mdconfig -a -t malloc -s 10m
# geli init -i 0 md0
# geli attach md0
# newfs -L test /dev/md0.eli
# mount /dev/ufs/test /mnt/tmp
# geli detach -l md0.eli
# umount /mnt/tmp
# glabel status
            Name  Status  Components
        ufs/test  N/A     N/A

Reviewed by: phk
Approved by: re (kensmith)
sys/geom/geom_event.c