From: Christoph Hellwig The __bdevname library function is leaking module references due to __bdevname ->get_gendisk ->kobj_lookup ->ata_probe ->get_disk ->try_module_get What we're trying to do in there is too ambitious. Change it to just print the major and minor. Signed-off-by: Andrew Morton --- 25-akpm/fs/partitions/check.c | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 deletions(-) diff -puN fs/partitions/check.c~__bdevname-leak-fix fs/partitions/check.c --- 25/fs/partitions/check.c~__bdevname-leak-fix 2004-07-04 15:56:29.970746240 -0700 +++ 25-akpm/fs/partitions/check.c 2004-07-04 15:56:29.974745632 -0700 @@ -137,25 +137,14 @@ const char *bdevname(struct block_device EXPORT_SYMBOL(bdevname); /* - * NOTE: this cannot be called from interrupt context. - * - * But in interrupt context you should really have a struct - * block_device anyway and use bdevname() above. + * There's very little reason to use this, you should really + * have a struct block_device just about everywhere and use + * bdevname() instead. */ const char *__bdevname(dev_t dev, char *buffer) { - struct gendisk *disk; - int part; - - disk = get_gendisk(dev, &part); - if (disk) { - buffer = disk_name(disk, part, buffer); - put_disk(disk); - } else { - snprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", + scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", MAJOR(dev), MINOR(dev)); - } - return buffer; } _