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)
This commit is contained in:
Pawel Jakub Dawidek 2007-09-27 20:18:34 +00:00
parent 3b2f6b3a4b
commit 3ea5d7ec24
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172354

View file

@ -145,6 +145,8 @@ g_orphan_register(struct g_provider *pp)
G_VALID_PROVIDER(pp);
g_trace(G_T_TOPOLOGY, "g_orphan_register(%s)", pp->name);
g_cancel_event(pp);
wf = pp->flags & G_PF_WITHER;
pp->flags &= ~G_PF_WITHER;