mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
bcache: add mutex lock for bch_is_open
Since bch_is_open will iterate linked list bch_cache_sets and uncached_devices, it needs bch_register_lock. Signed-off-by: Jianjian Huo <samuel.huo@gmail.com>
This commit is contained in:
parent
5b25abade2
commit
789d21dbd9
1 changed files with 2 additions and 0 deletions
|
@ -1966,10 +1966,12 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
|
|||
if (IS_ERR(bdev)) {
|
||||
if (bdev == ERR_PTR(-EBUSY)) {
|
||||
bdev = lookup_bdev(strim(path));
|
||||
mutex_lock(&bch_register_lock);
|
||||
if (!IS_ERR(bdev) && bch_is_open(bdev))
|
||||
err = "device already registered";
|
||||
else
|
||||
err = "device busy";
|
||||
mutex_unlock(&bch_register_lock);
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue