aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2012-01-09 18:43:59 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-10 13:08:55 -0500
commitace8577aeb438025ecf642f5eda3aa551d251951 (patch)
tree217979e10b342dd4c7494d10948fb659e8dfdb90 /fs
parenteaf5f9073533cde21c7121c136f1c3f072d9cf59 (diff)
block_dev: Suppress bdev_cache_init() kmemleak warninig
Kmemleak reports the following warning in bdev_cache_init() [ 0.003738] kmemleak: Object 0xffff880153035200 (size 256): [ 0.003823] kmemleak: comm "swapper/0", pid 0, jiffies 4294667299 [ 0.003909] kmemleak: min_count = 1 [ 0.003988] kmemleak: count = 0 [ 0.004066] kmemleak: flags = 0x1 [ 0.004144] kmemleak: checksum = 0 [ 0.004224] kmemleak: backtrace: [ 0.004303] [<ffffffff814755ac>] kmemleak_alloc+0x21/0x3e [ 0.004446] [<ffffffff811100ba>] kmem_cache_alloc+0xca/0x1dc [ 0.004592] [<ffffffff811371b1>] alloc_vfsmnt+0x1f/0x198 [ 0.004736] [<ffffffff811375c5>] vfs_kern_mount+0x36/0xd2 [ 0.004879] [<ffffffff8113929a>] kern_mount_data+0x18/0x32 [ 0.005025] [<ffffffff81ab9075>] bdev_cache_init+0x51/0x81 [ 0.005169] [<ffffffff81ab8abf>] vfs_caches_init+0x101/0x10d [ 0.005313] [<ffffffff81a9bae3>] start_kernel+0x344/0x383 [ 0.005456] [<ffffffff81a9b2a7>] x86_64_start_reservations+0xae/0xb2 [ 0.005602] [<ffffffff81a9b3ad>] x86_64_start_kernel+0x102/0x111 [ 0.005747] [<ffffffffffffffff>] 0xffffffffffffffff [ 0.008653] kmemleak: Trying to color unknown object at 0xffff880153035220 as Grey [ 0.008754] Pid: 0, comm: swapper/0 Not tainted 3.3.0-rc0-dbg-04200-g8180888-dirty #888 [ 0.008856] Call Trace: [ 0.008934] [<ffffffff81118704>] ? find_and_get_object+0x44/0x118 [ 0.009023] [<ffffffff81118fe6>] paint_ptr+0x57/0x8f [ 0.009109] [<ffffffff81475935>] kmemleak_not_leak+0x23/0x42 [ 0.009195] [<ffffffff81ab9096>] bdev_cache_init+0x72/0x81 [ 0.009282] [<ffffffff81ab8abf>] vfs_caches_init+0x101/0x10d [ 0.009368] [<ffffffff81a9bae3>] start_kernel+0x344/0x383 [ 0.009466] [<ffffffff81a9b2a7>] x86_64_start_reservations+0xae/0xb2 [ 0.009555] [<ffffffff81a9b140>] ? early_idt_handlers+0x140/0x140 [ 0.009643] [<ffffffff81a9b3ad>] x86_64_start_kernel+0x102/0x111 due to attempt to mark pointer to `struct vfsmount' as a gray object, which is embedded into `struct mount' returned from alloc_vfsmnt(). Make `bd_mnt' static, avoiding need to tell kmemleak to mark it gray, as suggested by Al Viro. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 69a5b6fbee2b..afe74dda632b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -25,7 +25,6 @@
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/namei.h> 26#include <linux/namei.h>
27#include <linux/log2.h> 27#include <linux/log2.h>
28#include <linux/kmemleak.h>
29#include <linux/cleancache.h> 28#include <linux/cleancache.h>
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
31#include "internal.h" 30#include "internal.h"
@@ -521,7 +520,7 @@ static struct super_block *blockdev_superblock __read_mostly;
521void __init bdev_cache_init(void) 520void __init bdev_cache_init(void)
522{ 521{
523 int err; 522 int err;
524 struct vfsmount *bd_mnt; 523 static struct vfsmount *bd_mnt;
525 524
526 bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode), 525 bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
527 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 526 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
@@ -533,12 +532,7 @@ void __init bdev_cache_init(void)
533 bd_mnt = kern_mount(&bd_type); 532 bd_mnt = kern_mount(&bd_type);
534 if (IS_ERR(bd_mnt)) 533 if (IS_ERR(bd_mnt))
535 panic("Cannot create bdev pseudo-fs"); 534 panic("Cannot create bdev pseudo-fs");
536 /* 535 blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
537 * This vfsmount structure is only used to obtain the
538 * blockdev_superblock, so tell kmemleak not to report it.
539 */
540 kmemleak_not_leak(bd_mnt);
541 blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
542} 536}
543 537
544/* 538/*