[PATCHSET 2/4] sysfs: allow suicide

Tejun Heo
2007-09-20T07:27:23Z

Hello, all.

This is the second patchset of four sysfs update patchset series[1]
and to be applied on top of the first patchset[1].

Currently, sysfs files which want to kill themselves should ask
someone else (workqueue) to kill it, which is so inhumane. This
patchset updates sysfs file implementation such that sysfs files can
commit suicide peacefully.

Global sledgehammer module unload inhibition/delay mechanism is
implemented and used to prevent premature unload while suicide is in
progress. Suicide attempt is detected by scanning sysfs_buffers for
matching accessor. If suicide is detected, active references the
accessor were holding are dropped early such that the suiciding node
can be deactivated without deadlock.

As active references go away early, the module basing the code the
accessor is running can go away before it finishes. Global module
unload inhibition is used here to prevent that until accessor callback
is complete.

This patchset contains the following four patches.

0001-module-implement-module_inhibit_unload.patch
0002-sysfs-make-the-sysfs_addrm_cxt-removed-list-FIFO.patch
0003-sysfs-care-free-suicide-for-sysfs-files.patch
0004-sysfs-make-suicidal-nodes-just-do-it-directly.patch

0001 needs Rusty Russell's ack.

Thanks.

--
tejun

[1] http://thread.gmane.org/gmane.linux.kernel/582105