Automatically detect deadlock condition in destroy_dev(), that is, if

destroy_dev() is called from csw method, and no d_purge driver method is
provided. Transform the direct call to destroy_dev() into destroy_dev_sched().

Reviewed by:	njl (programming interface)
Debugging help and testing by:	Peter Holm
Approved by:	re (kensmith)
This commit is contained in:
Konstantin Belousov 2007-07-03 17:43:20 +00:00
parent de10ffa527
commit 6f0281937b

View File

@ -779,10 +779,16 @@ destroy_devl(struct cdev *dev)
void
destroy_dev(struct cdev *dev)
{
struct cdevsw *csw;
dev_lock();
destroy_devl(dev);
dev_unlock_and_free();
csw = dev->si_devsw;
if ((csw != NULL && csw->d_purge != NULL) ||
dev->si_threadcount == 0) {
destroy_devl(dev);
dev_unlock_and_free();
} else
destroy_dev_sched(dev);
}
const char *