projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b25aba
)
bcache: add mutex lock for bch_is_open
author
Jianjian Huo
<samuel.huo@gmail.com>
Sun, 13 Jul 2014 16:08:59 +0000
(09:08 -0700)
committer
Kent Overstreet
<kmo@daterainc.com>
Mon, 4 Aug 2014 22:23:04 +0000
(15:23 -0700)
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>
drivers/md/bcache/super.c
patch
|
blob
|
history
diff --git
a/drivers/md/bcache/super.c
b/drivers/md/bcache/super.c
index b6114d672413004273b91cf743e0b872f899245c..60e75130a44c695b5fe565a6679963961d1b8a3c 100644
(file)
--- a/
drivers/md/bcache/super.c
+++ b/
drivers/md/bcache/super.c
@@
-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;
}