linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers
@ 2005-04-10 13:18 Norbert Preining
  2005-04-11 12:21 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Norbert Preining @ 2005-04-10 13:18 UTC (permalink / raw)
  To: linux-hotplug

Hi all!

Is the following a bug or feature: If I have the option
	all_partitions
set in my local rules.d file, all the device nodes for all partitions
are created, but for those which are *NOT* physically available, the
minor of the last available is used:

Examples: I have an sdcard reader which I NAME /dev/sdcardX, and the
card has only one partition. But the created devices look like:
brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
...

Here it is not really a problem, but it really hit me when I was using a
new hard disk which did NOT contain already a partition table (so a bit
like a floppy). So, I got minor 0 (!!!) for all /dev/sdbN (ie the
partitions). I (stupid me) didn't check, made mke2fs -j /dev/sdb1 and
voilà, now I have a floppy instead of a external firewire harddisk with
a normal partition table. Grmmm.

So my question: Is this a feature or a bug?

[Please Cc me, thanks]

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
sip:preining@at43.tuwien.ac.at                             +43 (0) 59966-690018
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
KANTURK (n.)
An extremely intricate knot originally used for belaying the
topgallant foresheets of a gaff-rigged China clipper, and now more
commonly observed when trying to get an old kite out of the cupboard
under the stairs.
			--- Douglas Adams, The Meaning of Liff


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
@ 2005-04-11 12:21 ` Kay Sievers
  2005-04-11 12:55 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2005-04-11 12:21 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2005-04-10 at 15:18 +0200, Norbert Preining wrote:
> Hi all!
> 
> Is the following a bug or feature: If I have the option
> 	all_partitions
> set in my local rules.d file, all the device nodes for all partitions
> are created, but for those which are *NOT* physically available, the
> minor of the last available is used:
> 
> Examples: I have an sdcard reader which I NAME /dev/sdcardX, and the
> card has only one partition. But the created devices look like:
> brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3

This looks broken.

> Here it is not really a problem, but it really hit me when I was using a
> new hard disk which did NOT contain already a partition table (so a bit
> like a floppy). So, I got minor 0 (!!!) for all /dev/sdbN (ie the
> partitions). I (stupid me) didn't check, made mke2fs -j /dev/sdb1 and
> voilà, now I have a floppy instead of a external firewire harddisk with
> a normal partition table. Grmmm.
> 
> So my question: Is this a feature or a bug?

Looks like a bug, but I have no idea, how this can happen.
What version of udev do you use?

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
  2005-04-11 12:21 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
@ 2005-04-11 12:55 ` Norbert Preining
  2005-04-11 13:16 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Norbert Preining @ 2005-04-11 12:55 UTC (permalink / raw)
  To: linux-hotplug

Hi Kay!

On Mon, 11 Apr 2005, Kay Sievers wrote:
> > brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
> 
> This looks broken.

Good to hear. But to be sure, I have the following rule configured,
maybe it is just an error of me:
SYSFS{model}="Flash R/W", NAME{all_partitions}="sdcard", SYMLINK="%k"

> > like a floppy). So, I got minor 0 (!!!) for all /dev/sdbN (ie the
> > 
> > So my question: Is this a feature or a bug?
> 
> Looks like a bug, but I have no idea, how this can happen.
> What version of udev do you use?

debian/sid:
udev           0.056-2

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
sip:preining@at43.tuwien.ac.at                             +43 (0) 59966-690018
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
TOLSTACHAOLAIS (phr.)
What the police in Leith require you to say in order to prove that you
are not drunk.
			--- Douglas Adams, The Meaning of Liff


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
  2005-04-11 12:21 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
  2005-04-11 12:55 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
@ 2005-04-11 13:16 ` Kay Sievers
  2005-04-11 13:50 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Tobias Klauser
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2005-04-11 13:16 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2005-04-11 at 14:55 +0200, Norbert Preining wrote:
> Hi Kay!
> 
> On Mon, 11 Apr 2005, Kay Sievers wrote:
> > > brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
> > 
> > This looks broken.
> 
> Good to hear.

I still don't know why this happens - I'll try to reproduce it here...

> But to be sure, I have the following rule configured,
> maybe it is just an error of me:
> SYSFS{model}="Flash R/W", NAME{all_partitions}="sdcard", SYMLINK="%k"

You should limit the rule to the main block device:
  KERNEL="sd[a-z]"

This may prevent it.

Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
                   ` (2 preceding siblings ...)
  2005-04-11 13:16 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
@ 2005-04-11 13:50 ` Tobias Klauser
  2005-04-11 14:30 ` Norbert Preining
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2005-04-11 13:50 UTC (permalink / raw)
  To: linux-hotplug

On Mon, Apr 11, 2005 at 03:16:20PM +0200, Kay Sievers wrote:
> On Mon, 2005-04-11 at 14:55 +0200, Norbert Preining wrote:
> > On Mon, 11 Apr 2005, Kay Sievers wrote:
> > > > brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
> > > 
> > > This looks broken.
> > 
> > Good to hear.

Yeah, I guess it's broken. In create_node() in udev_add.c there is
always added 1 to the minor number, thus the error. The attached patch
should fix this.

Cheers, Tobias

--- udev-056.orig/udev_add.c	2005-03-28 12:59:12.000000000 +0200
+++ udev-056/udev_add.c	2005-04-11 15:47:24.700854424 +0200
@@ -182,7 +182,7 @@ static int create_node(struct udevice *u
 
 				snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i);
 				partitionname[sizeof(partitionname)-1] = '\0';
-				part_devt = makedev(major(udev->devt), minor(udev->devt)+1);
+				part_devt = makedev(major(udev->devt), minor(udev->devt)+i);
 				udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid);
 			}
 		}


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
                   ` (3 preceding siblings ...)
  2005-04-11 13:50 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Tobias Klauser
@ 2005-04-11 14:30 ` Norbert Preining
  2005-04-11 14:56 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
  2005-04-11 14:58 ` Kay Sievers
  6 siblings, 0 replies; 8+ messages in thread
From: Norbert Preining @ 2005-04-11 14:30 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 11 Apr 2005, Kay Sievers wrote:
> > But to be sure, I have the following rule configured,
> > maybe it is just an error of me:
> > SYSFS{model}="Flash R/W", NAME{all_partitions}="sdcard", SYMLINK="%k"
> 
> You should limit the rule to the main block device:
>   KERNEL="sd[a-z]"

I did this, but it didn't change anything. I have an external firewire
driver which I configure as follows:
BUS="scsi", KERNEL="sd[a-z]", SYSFS{model}="OneTouch II", NAME{all_partitions}="maxtor", SYMLINK="%k"
and I get the following device nodes:
brw-rw----  1 root root 8, 16 2005-04-11 16:24 /dev/maxtor
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor1
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor10
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor11
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor12
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor13
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor14
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor15
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor2
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor3
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor4
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor5
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor6
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor7
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor8
brw-rw----  1 root root 8, 17 2005-04-11 16:24 /dev/maxtor9

Umpf.

When I delete the {all_partitions} I get:
brw-rw----  1 root root 8, 16 2005-04-11 16:26 /dev/maxtor
lrwxrwxrwx  1 root root     6 2005-04-11 16:26 /dev/sdb -> maxtor
brw-rw----  1 root disk 8, 17 2005-04-11 16:26 /dev/sdb1

which is CORRECT (This is what happened when you make a floppy drive
from your hard disk my not partitioning!). Interstingly this is still a
problem, as I have to use sdb1 (maj/min 8,17) for accessing the file
system!


Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
sip:preining@at43.tuwien.ac.at                             +43 (0) 59966-690018
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
CLUNES (pl.n.)
People who just won't go.
			--- Douglas Adams, The Meaning of Liff


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
                   ` (4 preceding siblings ...)
  2005-04-11 14:30 ` Norbert Preining
@ 2005-04-11 14:56 ` Kay Sievers
  2005-04-11 14:58 ` Kay Sievers
  6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2005-04-11 14:56 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2005-04-11 at 15:50 +0200, Tobias Klauser wrote:
> On Mon, Apr 11, 2005 at 03:16:20PM +0200, Kay Sievers wrote:
> > On Mon, 2005-04-11 at 14:55 +0200, Norbert Preining wrote:
> > > On Mon, 11 Apr 2005, Kay Sievers wrote:
> > > > > brw-rw----  1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> > > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> > > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> > > > > brw-rw----  1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
> > > > 
> > > > This looks broken.
> > > 
> > > Good to hear.
> 
> Yeah, I guess it's broken. In create_node() in udev_add.c there is
> always added 1 to the minor number, thus the error. The attached patch
> should fix this.

Sure, it is a stupid bug! Thanks for finding this. I will fix it now for
the 057 version and add a test for it.

Many thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Feature/Bug? udev/hotplug creates device nodes with strange
  2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
                   ` (5 preceding siblings ...)
  2005-04-11 14:56 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
@ 2005-04-11 14:58 ` Kay Sievers
  6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2005-04-11 14:58 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 2005-04-11 at 16:30 +0200, Norbert Preining wrote:
> On Mon, 11 Apr 2005, Kay Sievers wrote:
> > > But to be sure, I have the following rule configured,
> > > maybe it is just an error of me:
> > > SYSFS{model}="Flash R/W", NAME{all_partitions}="sdcard", SYMLINK="%k"
> > 
> > You should limit the rule to the main block device:
> >   KERNEL="sd[a-z]"
> 
> I did this, but it didn't change anything.

Tobias found the bug I introduced by switching the int to dev_t a few
weeks ago. Sorry and thanks for your testing. I will fix it now.

Thanks again,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2005-04-11 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-10 13:18 Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
2005-04-11 12:21 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
2005-04-11 12:55 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Norbert Preining
2005-04-11 13:16 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
2005-04-11 13:50 ` Feature/Bug? udev/hotplug creates device nodes with strange major/minor numbers Tobias Klauser
2005-04-11 14:30 ` Norbert Preining
2005-04-11 14:56 ` Feature/Bug? udev/hotplug creates device nodes with strange Kay Sievers
2005-04-11 14:58 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).