Commit 50f689af authored by Zhu Yanhai's avatar Zhu Yanhai Committed by Theodore Ts'o

jbd2: move bdget out of critical section

bdget() should not be called when we hold spinlocks since
it might sleep.
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarZhu Yanhai <gaoyang.zyh@taobao.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 0ce790e7
...@@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device) ...@@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device)
new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
if (!new_dev) if (!new_dev)
return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
bd = bdget(device);
spin_lock(&devname_cache_lock); spin_lock(&devname_cache_lock);
if (devcache[i]) { if (devcache[i]) {
if (devcache[i]->device == device) { if (devcache[i]->device == device) {
kfree(new_dev); kfree(new_dev);
bdput(bd);
ret = devcache[i]->devname; ret = devcache[i]->devname;
spin_unlock(&devname_cache_lock); spin_unlock(&devname_cache_lock);
return ret; return ret;
...@@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device) ...@@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device)
} }
devcache[i] = new_dev; devcache[i] = new_dev;
devcache[i]->device = device; devcache[i]->device = device;
bd = bdget(device);
if (bd) { if (bd) {
bdevname(bd, devcache[i]->devname); bdevname(bd, devcache[i]->devname);
bdput(bd); bdput(bd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment