aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/journal.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 18bfd5dab642..7b545c3b3942 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2410,6 +2410,7 @@ const char *jbd2_dev_to_name(dev_t device)
2410 int i = hash_32(device, CACHE_SIZE_BITS); 2410 int i = hash_32(device, CACHE_SIZE_BITS);
2411 char *ret; 2411 char *ret;
2412 struct block_device *bd; 2412 struct block_device *bd;
2413 static struct devname_cache *new_dev;
2413 2414
2414 rcu_read_lock(); 2415 rcu_read_lock();
2415 if (devcache[i] && devcache[i]->device == device) { 2416 if (devcache[i] && devcache[i]->device == device) {
@@ -2419,20 +2420,20 @@ const char *jbd2_dev_to_name(dev_t device)
2419 } 2420 }
2420 rcu_read_unlock(); 2421 rcu_read_unlock();
2421 2422
2423 new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
2424 if (!new_dev)
2425 return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
2422 spin_lock(&devname_cache_lock); 2426 spin_lock(&devname_cache_lock);
2423 if (devcache[i]) { 2427 if (devcache[i]) {
2424 if (devcache[i]->device == device) { 2428 if (devcache[i]->device == device) {
2429 kfree(new_dev);
2425 ret = devcache[i]->devname; 2430 ret = devcache[i]->devname;
2426 spin_unlock(&devname_cache_lock); 2431 spin_unlock(&devname_cache_lock);
2427 return ret; 2432 return ret;
2428 } 2433 }
2429 call_rcu(&devcache[i]->rcu, free_devcache); 2434 call_rcu(&devcache[i]->rcu, free_devcache);
2430 } 2435 }
2431 devcache[i] = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); 2436 devcache[i] = new_dev;
2432 if (!devcache[i]) {
2433 spin_unlock(&devname_cache_lock);
2434 return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
2435 }
2436 devcache[i]->device = device; 2437 devcache[i]->device = device;
2437 bd = bdget(device); 2438 bd = bdget(device);
2438 if (bd) { 2439 if (bd) {