Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 789d21db authored by Jianjian Huo's avatar Jianjian Huo Committed by Kent Overstreet
Browse files

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: default avatarJianjian Huo <samuel.huo@gmail.com>
parent 5b25abad
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
	}