Skip to content

Commit

Permalink
jbd2: move bdget out of critical section
Browse files Browse the repository at this point in the history
bdget() should not be called when we hold spinlocks since
it might sleep.

Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Zhu Yanhai <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
  • Loading branch information
jesuszhu authored and tytso committed Apr 4, 2011
1 parent 0ce790e commit 50f689a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device)
new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
if (!new_dev)
return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
bd = bdget(device);
spin_lock(&devname_cache_lock);
if (devcache[i]) {
if (devcache[i]->device == device) {
kfree(new_dev);
bdput(bd);
ret = devcache[i]->devname;
spin_unlock(&devname_cache_lock);
return ret;
Expand All @@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device)
}
devcache[i] = new_dev;
devcache[i]->device = device;
bd = bdget(device);
if (bd) {
bdevname(bd, devcache[i]->devname);
bdput(bd);
Expand Down

0 comments on commit 50f689a

Please sign in to comment.