diff options
author | Zhu Yanhai <zhu.yanhai@gmail.com> | 2011-04-04 16:58:12 (GMT) |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-04-04 16:58:12 (GMT) |
commit | 50f689af019b19f9b9a39be782c21b6f52b1615a (patch) | |
tree | 40b80bb3acc51ebfba7199c0fadff25da2ee6d51 /fs | |
parent | 0ce790e7d736cedc563e1fb4e998babf5a4dbc3d (diff) | |
download | linux-50f689af019b19f9b9a39be782c21b6f52b1615a.tar.xz |
jbd2: move bdget out of critical section
bdget() should not be called when we hold spinlocks since
it might sleep.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jbd2/journal.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 90407b8..33dd3ef 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -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; @@ -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); |