bcache: fix lockdep warnings on shutdown

This commit is contained in:
Slava Pestov 2014-04-29 15:39:27 -07:00 committed by Kent Overstreet
parent 8b326d3a2a
commit e5112201c1

View File

@ -1214,7 +1214,9 @@ void bch_flash_dev_release(struct kobject *kobj)
static void flash_dev_free(struct closure *cl) static void flash_dev_free(struct closure *cl)
{ {
struct bcache_device *d = container_of(cl, struct bcache_device, cl); struct bcache_device *d = container_of(cl, struct bcache_device, cl);
mutex_lock(&bch_register_lock);
bcache_device_free(d); bcache_device_free(d);
mutex_unlock(&bch_register_lock);
kobject_put(&d->kobj); kobject_put(&d->kobj);
} }
@ -1222,7 +1224,9 @@ static void flash_dev_flush(struct closure *cl)
{ {
struct bcache_device *d = container_of(cl, struct bcache_device, cl); struct bcache_device *d = container_of(cl, struct bcache_device, cl);
mutex_lock(&bch_register_lock);
bcache_device_unlink(d); bcache_device_unlink(d);
mutex_unlock(&bch_register_lock);
kobject_del(&d->kobj); kobject_del(&d->kobj);
continue_at(cl, flash_dev_free, system_wq); continue_at(cl, flash_dev_free, system_wq);
} }