]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drbd: debugfs: deal with destructor racing with open of debugfs file
authorLars Ellenberg <lars.ellenberg@linbit.com>
Mon, 5 May 2014 12:05:54 +0000 (12:05 +0000)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Jul 2014 16:35:17 +0000 (18:35 +0200)
commit4a521cca9b9b2e943efb86645540aecccfeab0fc
treec42f93313e79afecfda220fd134f953bdaaaaf56
parentdb1866ffeed2e142208a801f7598326b92ebf7c5
drbd: debugfs: deal with destructor racing with open of debugfs file

Try to close the race between open() and debugfs_remove_recursive()
from inside an object destructor.
Once open succeeds, the object should stay around.
Open should not succeed if the object has already reached its destructor.

This may be overkill, but to make that happen, we check for existence of
a parent directory, "stale-ness" of "this" dentry, and serialize
kref_get_unless_zero() on the outermost object relevant for this file
with d_delete() on this dentry (using the parent's i_mutex).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_debugfs.c