diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-06-20 23:34:44 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-06-20 23:34:44 -0400 |
commit | b574480507460b8e31b8d38dd4642219fc3b9a10 (patch) | |
tree | 666d731d897ce463fcc6ccf46e82f200ae18e589 | |
parent | 627ad9fd0733f0a31a266ff98a4a933eee710f0b (diff) |
jbd2: Remove GFP_ATOMIC kmalloc from inside spinlock critical region
Fix jbd2_dev_to_name(), a function used when pretty-printting jbd2 and
ext4 tracepoints.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/jbd2/journal.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 18bfd5dab64..7b545c3b394 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2410,6 +2410,7 @@ const char *jbd2_dev_to_name(dev_t device) int i = hash_32(device, CACHE_SIZE_BITS); char *ret; struct block_device *bd; + static struct devname_cache *new_dev; rcu_read_lock(); if (devcache[i] && devcache[i]->device == device) { @@ -2419,20 +2420,20 @@ const char *jbd2_dev_to_name(dev_t device) } rcu_read_unlock(); + new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); + if (!new_dev) + return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ spin_lock(&devname_cache_lock); if (devcache[i]) { if (devcache[i]->device == device) { + kfree(new_dev); ret = devcache[i]->devname; spin_unlock(&devname_cache_lock); return ret; } call_rcu(&devcache[i]->rcu, free_devcache); } - devcache[i] = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); - if (!devcache[i]) { - spin_unlock(&devname_cache_lock); - return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ - } + devcache[i] = new_dev; devcache[i]->device = device; bd = bdget(device); if (bd) { |