public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* bdi: register sysfs bdi device only once per queue
@ 2008-11-03 15:53 Kay Sievers
  2008-11-03 16:08 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Kay Sievers @ 2008-11-03 15:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Folkert van Heusden, Peter Korsgaard, linux-kernel

Andrew, can you pick this up this please?

Thanks,
Kay


From: Kay Sievers <kay.sievers@vrfy.org>
Subject: bdi: register sysfs bdi device only once per queue

Devices which share the same queue, like floppies and mtd devices,
get registered multiple times in the bdi interface, but bdi accounts
only the last registered device of the devices sharing one queue.

On remove, all earlier registered devices leak, stay around in
sysfs, and cause "duplicate filename" errors if the devices are
re-created.

This prevents the creation of multiple bdi interfaces per queue,
and the bdi device will carry the dev_t name of the block device
which is the first one registered, of the pool of devices using
the same queue.

Tested-By: Peter Korsgaard <jacmet@sunsite.dk>
Acked-By: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
---

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f2e574d..e6676e5 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -176,6 +176,9 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
 	int ret = 0;
 	struct device *dev;
 
+	if (bdi->dev)
+		goto exit;
+
 	va_start(args, fmt);
 	dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args);
 	va_end(args);



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-07 14:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-03 15:53 bdi: register sysfs bdi device only once per queue Kay Sievers
2008-11-03 16:08 ` Peter Zijlstra
2008-11-05 20:10   ` Andrew Morton
2008-11-05 22:10     ` David Woodhouse
2008-11-05 22:21       ` Peter Zijlstra
2008-11-07 14:11       ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox