linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
@ 2005-09-08 12:43 Thomas Heinz
  2005-09-08 14:11 ` Kay Sievers
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-08 12:43 UTC (permalink / raw)
  To: linux-hotplug

Hi

The following gentoo rule is responsible for handling my ide zip drive 
(ide-floppy driver).

BUS="ide",     KERNEL="hd[a-z]", ACTION="add", IMPORT="/sbin/cdrom_id
--export $tempnode"

cdrom_id tries to open the device and the kernel outputs the message. 
Debian seems to handle the issue differently with the following rule.

BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \
  PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \
                                        NAME="%k", 
OPTIONS+="all_partitions"


Do you consider it the distributors' job to fix the issue or would you 
rather fix cdrom_id?

Thanks for your input.


Regards,

Thomas


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
@ 2005-09-08 14:11 ` Kay Sievers
  2005-09-08 15:11 ` Thomas Heinz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2005-09-08 14:11 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Sep 08, 2005 at 02:43:29PM +0200, Thomas Heinz wrote:
> The following gentoo rule is responsible for handling my ide zip drive 
> (ide-floppy driver).
> 
> BUS="ide",     KERNEL="hd[a-z]", ACTION="add", IMPORT="/sbin/cdrom_id
> --export $tempnode"
> 
> cdrom_id tries to open the device and the kernel outputs the message. 
> Debian seems to handle the issue differently with the following rule.
> 
> BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \
>   PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \
>                                         NAME="%k", 
> OPTIONS+="all_partitions"
> 
> 
> Do you consider it the distributors' job to fix the issue or would you 
> rather fix cdrom_id?

cdrom_id itself can't know what kind of device it is before it has opened
it. No idea why the kernel still prints this. I thought we removed all these
stupid messages.
It would be nice to have all the information available in /sys that is
only in /proc, but the IDE maintainers are not really interested in
proper driver core integration. Hopefully the libata effort will move
everything including parallel ata to the scsi layer some day, which provides
all what we need in /sys.

You may try to add something like this to the ide cdrom_id rule:
  ... , PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom",  ...

I didn't test it and I don't remember if "cdrom" was the right value here.
(I don't have cdrom in the last box that uses the old ide drivers.)

Would be nice if you could test this?

Thanks,
Kay


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
  2005-09-08 14:11 ` Kay Sievers
@ 2005-09-08 15:11 ` Thomas Heinz
  2005-09-08 15:38 ` Thomas Heinz
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-08 15:11 UTC (permalink / raw)
  To: linux-hotplug

Hi Kay,

thanks for your quick response.

You wrote:
> cdrom_id itself can't know what kind of device it is before it has
> opened it. No idea why the kernel still prints this. I thought we
> removed all these stupid messages.

It appears that the error message comes from drivers/ide/ide-floppy.c. Both 
idefloppy_setup() and idefloppy_open() call idefloppy_capacity which in 
turn outputs the message. So either the printk() should be removed or the 
logic should be changed somehow assuming that there is some case where the 
output makes sense.

> You may try to add something like this to the ide cdrom_id rule:
>   ... , PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom",  ...
>
> I didn't test it and I don't remember if "cdrom" was the right value
> here. (I don't have cdrom in the last box that uses the old ide
> drivers.)
>
> Would be nice if you could test this?

Good idea, works nicely. I will suggest this modification to the gentoo 
maintainers.


Best regards,

Thomas


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
  2005-09-08 14:11 ` Kay Sievers
  2005-09-08 15:11 ` Thomas Heinz
@ 2005-09-08 15:38 ` Thomas Heinz
  2005-09-08 19:18 ` Kay Sievers
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-08 15:38 UTC (permalink / raw)
  To: linux-hotplug

Unfortunately, a similar problem occurs with my SCSI CD-RW drive. It is 
caused by the rule:

BUS="scsi",    KERNEL="sr[0-9]*", ACTION="add", IMPORT="/sbin/cdrom_id 
--export $tempnode"

Now in this case, it is really about a "cdrom". The message seems to be 
from drivers/scsi/scsi_ioctl.c. Interestingly, my other SCSI "cdrom" (in 
fact a DVD-RAM drive) does not cause such a warning.

What is your suggestion?


Regards,

Thomas


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (2 preceding siblings ...)
  2005-09-08 15:38 ` Thomas Heinz
@ 2005-09-08 19:18 ` Kay Sievers
  2005-09-08 21:26 ` Thomas Heinz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2005-09-08 19:18 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

On Thu, Sep 08, 2005 at 05:38:22PM +0200, Thomas Heinz wrote:
> Unfortunately, a similar problem occurs with my SCSI CD-RW drive. It is 
> caused by the rule:
> 
> BUS=="scsi",    KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id 
> --export $tempnode"
> 
> Now in this case, it is really about a "cdrom". The message seems to be 
> from drivers/scsi/scsi_ioctl.c. Interestingly, my other SCSI "cdrom" (in 
> fact a DVD-RAM drive) does not cause such a warning.
> 
> What is your suggestion?

Can you try this patch? Only a wild guess that it may help...

Kay

[-- Attachment #2: cdrom_id-01.patch --]
[-- Type: text/plain, Size: 1016 bytes --]

diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -36,6 +36,8 @@
  * with all of the DVD flags.  So we just include our own, aren't
  * we so nice...
  */
+#define CDO_USE_FFLAGS		0x4	/* use O_NONBLOCK information on open */
+#define CDROM_SET_OPTIONS	0x5320	/* Set behavior options */
 #define CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
 
 /* capability flags used with the uniform CD-ROM driver */
@@ -115,14 +117,21 @@ int main(int argc, char *argv[])
 	fd = open(node, O_RDONLY|O_NONBLOCK);
 	if (fd < 0) {
 		info("unable to open '%s'", node);
-		rc = 1;
+		rc = 2;
 		goto exit;
 	}
 
+	result = ioctl(fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS);
+	if (result < 0) {
+		info("CDROM_SET_OPTIONS failed for '%s'", node);
+		rc = 3;
+		goto close;
+	}
+
 	result = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
 	if (result < 0) {
 		info("CDROM_GET_CAPABILITY failed for '%s'", node);
-		rc = 3;
+		rc = 4;
 		goto close;
 	}
 

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

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (3 preceding siblings ...)
  2005-09-08 19:18 ` Kay Sievers
@ 2005-09-08 21:26 ` Thomas Heinz
  2005-09-09 11:17 ` Kay Sievers
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-08 21:26 UTC (permalink / raw)
  To: linux-hotplug

Thanks for your help Kay.

You wrote:
> Can you try this patch? Only a wild guess that it may help...

Unfortunately, it does not.

Interestingly, I found out that the kernel message is generated on 
close(fd) (line 151).

Does this help you further?


Best regards,

Thomas


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (4 preceding siblings ...)
  2005-09-08 21:26 ` Thomas Heinz
@ 2005-09-09 11:17 ` Kay Sievers
  2005-09-14 22:34 ` Thomas Heinz
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2005-09-09 11:17 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Sep 08, 2005 at 11:26:37PM +0200, Thomas Heinz wrote:
> Thanks for your help Kay.
> 
> You wrote:
> > Can you try this patch? Only a wild guess that it may help...
> 
> Unfortunately, it does not.
> 
> Interestingly, I found out that the kernel message is generated on 
> close(fd) (line 151).
> 
> Does this help you further?

Hmm, no idea. I tested it remotely on a few boxes with a SCSI cdrom
and none of them prints anything on a cdrom_id run.

Kay


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (5 preceding siblings ...)
  2005-09-09 11:17 ` Kay Sievers
@ 2005-09-14 22:34 ` Thomas Heinz
  2005-09-14 23:21 ` Kay Sievers
  2005-09-15  7:51 ` Thomas Heinz
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-14 22:34 UTC (permalink / raw)
  To: linux-hotplug

Hi Kay

You wrote:
> > Interestingly, I found out that the kernel message is generated on
> > close(fd) (line 151).
>
> Hmm, no idea. I tested it remotely on a few boxes with a SCSI cdrom
> and none of them prints anything on a cdrom_id run.

On close(), scsi_set_medium_removal() is called which again calls  
ioctl_internal_command(). The scsi request is initiated here:
http://lxr.linux.no/source/drivers/scsi/scsi_ioctl.c#L109
It "returns" NOT_READY which effectively causes the kernel message.

In order to avoid the message during bootup, I have defined some rules 
before the default rule set which mimic the effect of executing cdrom_id 
without actually doing it. The execution of the default rule set for the 
specific scsi device is avoided by the last_rule option.

Since only one of my scsi cdrom devices behaves like this (and moreover you 
could not reproduce the behaviour), it is probably not a general problem. 
What do you suggest to further track the problem down?


Regards,

Thomas


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (6 preceding siblings ...)
  2005-09-14 22:34 ` Thomas Heinz
@ 2005-09-14 23:21 ` Kay Sievers
  2005-09-15  7:51 ` Thomas Heinz
  8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2005-09-14 23:21 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Sep 15, 2005 at 12:34:47AM +0200, Thomas Heinz wrote:
> You wrote:
> > > Interestingly, I found out that the kernel message is generated on
> > > close(fd) (line 151).
> >
> > Hmm, no idea. I tested it remotely on a few boxes with a SCSI cdrom
> > and none of them prints anything on a cdrom_id run.
> 
> On close(), scsi_set_medium_removal() is called which again calls  
> ioctl_internal_command(). The scsi request is initiated here:
> http://lxr.linux.no/source/drivers/scsi/scsi_ioctl.c#L109
> It "returns" NOT_READY which effectively causes the kernel message.
> 
> In order to avoid the message during bootup, I have defined some rules 
> before the default rule set which mimic the effect of executing cdrom_id 
> without actually doing it. The execution of the default rule set for the 
> specific scsi device is avoided by the last_rule option.
> 
> Since only one of my scsi cdrom devices behaves like this (and moreover you 
> could not reproduce the behaviour), it is probably not a general problem. 

Hmm I wouldn't call it a "problem". It's just a message from our noisy
kernel. :)
I don't see a nice way to prevent that from userspace. We just asks the
device to identify itself, which should not trigger media validation.
Don't know if there is a trick we don't know about now.

> What do you suggest to further track the problem down?

The benefit of a lot of kernel messages for things like this is really
questionable. Maybe the firmware in your device has some weird behavior.
Unfortunately, I don't know how to debug this and I better go fix some of
the real bugs we have. :)

Thanks,
Kay


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 10+ messages in thread

* Re: cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media
  2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
                   ` (7 preceding siblings ...)
  2005-09-14 23:21 ` Kay Sievers
@ 2005-09-15  7:51 ` Thomas Heinz
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Heinz @ 2005-09-15  7:51 UTC (permalink / raw)
  To: linux-hotplug

You wrote:
> Hmm I wouldn't call it a "problem". It's just a message from our noisy
> kernel. :)

I definitely agree. It's only a minor "cosmetic" issue.

> I don't see a nice way to prevent that from userspace. We just asks the
> device to identify itself, which should not trigger media validation.
> Don't know if there is a trick we don't know about now.
>
> > What do you suggest to further track the problem down?
>
> The benefit of a lot of kernel messages for things like this is really
> questionable. Maybe the firmware in your device has some weird behavior.
> Unfortunately, I don't know how to debug this and I better go fix some
> of the real bugs we have. :)

Ok. I perfectly understand that this issue is hardly of any importance. It 
might be more interesting if it would occur for a number of devices (and 
not only my single cd-rw ;). Maybe someone else stumbles over this thread 
who immediately knows what could be the reason for the behaviour. 
Personally, I can live with my workaround and since I am not familiar with 
the scsi code, it would not really pay off to delve into it just to make 
the boot screen look a little better :-)

Thanks for your time and support.


Regards,

Thomas


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 10+ messages in thread

end of thread, other threads:[~2005-09-15  7:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-08 12:43 cdrom_id (udev) causes "No disk in drive" warning for ide devices with removable media Thomas Heinz
2005-09-08 14:11 ` Kay Sievers
2005-09-08 15:11 ` Thomas Heinz
2005-09-08 15:38 ` Thomas Heinz
2005-09-08 19:18 ` Kay Sievers
2005-09-08 21:26 ` Thomas Heinz
2005-09-09 11:17 ` Kay Sievers
2005-09-14 22:34 ` Thomas Heinz
2005-09-14 23:21 ` Kay Sievers
2005-09-15  7:51 ` Thomas Heinz

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).