Description of problem: When a program attempts to open a USB floppy device (with something like 'open ("/dev/sdb", O_RDWR)'), and there is no media present in the drive, the system doesn't generate the correct response--it allows the drive to be opened, and a lot of error messages are spewed as the system attemts to "revalidate" the drive. Version-Release number of selected component (if applicable): all the RHEL 3 releases. How reproducible: Always. Steps to Reproduce: 1. (test program attached) 2. 3. Actual results: The "open" of user mode application returns success code but lots of error messages in /var/log/messages file. Expected results: The open call fails with ENOMEDIUM error with errors in /var/log/messages subside. Additional info:
Created attachment 114022 [details] a simple and plain program to demonstrate the problem.
Created attachment 114023 [details] The agreed patch to address this issue. There have been discussions about this issue in the IT and the team (and customer) has agreed with the uploaded patch. Pete Zaitcev in the engineering end has been looking into this issue.
Created attachment 114024 [details] The original proposed patch made by Dell's Stuart Hayes.
(3-3) updated by Dell's Stuart Hayes That patch doesn't stop the ugly messages, though it does appear to cause the right error code to be returned. With this code: fd = open ("/dev/sdb", O_RDWR); if (fd<0) perror (""); I get the following output on an unmodified 2.4.21-20.ELsmp: sdb : READ CAPACITY failed. sdb : status = 1, message = 00, host = 0, driver = 08 Current sd00:00: sense key Not Ready Additional sense indicates Medium not present sdb : block size assumed to be 512 bytes, disk size 1GB sdb: Write Protect is on I/O error: dev 08:10, sector 0 unable to read partition table Read-only file system With the smaller patch immediately above, I get this: sdb : READ CAPACITY failed. sdb : status = 1, message = 00, host = 0, driver = 08 Current sd00:00: sense key Not Ready Additional sense indicates Medium not present sdb : block size assumed to be 512 bytes, disk size 1GB I/O error: dev 08:10, sector 0 unable to read partition table No medium found And with my patch that mimics what is done in the 2.6 kernel, I get this: No medium found So I think my original patch is better, but if you're worried about it breaking something and prefer the smaller patch, I guess it is fine..
I understand what Stuart is saying in comment #6. My concern is with the "goto sd_init_onedisk_no_media;" regarding things like Fujitsu's MO drive and stuff... That's why I proposed the minimal patch.
Pete, please remember to add the appropriate kernel pool maintainer to the cc: list when (re)assigning bugs from "kernel-maint". Thanks.
Pete may have a point, I'm not familiar with the Fujitsu MO drive. His patch seem to address the real issue, in that it prevents the drive from being opened and returns the right error code. I don't think anyone is going to complain about the extra error messages.
OK, this bug is on track to fix the open(2). I'm posting for internal acks right now, to target U6. Regarding messages, they are very annoying, no question. Worse, they eat into my precious dmesg buffer. I have a bug open for the messages, see bug 157667. Stuart, you might want to get on cc: for it.
A fix for this problem has just been committed to the RHEL3 U6 patch pool this evening (in kernel version 2.4.21-32.5.EL).
Rob, please read this: http://post-office.corp.redhat.com/archives/rhkernel-list/2005-July/msg00822.html
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2005-663.html