Red Hat Bugzilla – Full Text Bug Listing
|Summary:||sdparm --command=stop is ineffective|
|Product:||[Fedora] Fedora||Reporter:||Pádraig Brady <p>|
|Component:||sdparm||Assignee:||Terje Røsten <terjeros>|
|Status:||CLOSED ERRATA||QA Contact:||Fedora Extras Quality Assurance <extras-qa>|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2010-04-16 15:50:31 EDT||Type:||---|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
Description Pádraig Brady 2010-02-04 10:44:17 EST
Created attachment 388817 [details] open the device read only In fedora 8 the above command would spin down my usb disk immediately. In F11 with sdparm-1.04-1.fc11.i586 I can here the disk respond with to the command but it seems to spin up again immediately. I think this is probably the same issue as: https://bugs.launchpad.net/ubuntu/+source/hdparm/+bug/388506 The workaround described there wrt changing the udev rule works for me. Also sdparm does open the device RDWR as verified by: # strace -e open sdparm --verbose --command=stop /dev/sdc open("/dev/sdc", O_RDWR|O_NONBLOCK) = 3 Also sdparm with the attached patch spins down the drive.
Comment 1 Dan Horák 2010-02-04 11:11:47 EST
The patch makes sense to me, but I talk to the author of sdparm before applying.
Comment 2 Terje Røsten 2010-02-14 15:19:23 EST
Any news from upstream?
Comment 3 Dan Horák 2010-02-15 04:42:29 EST
yes, we discussed it and it's not so simple due some difference between SCSI and ATA. As a result new command-line switch for opening the device RO is introduced and I have a release candidates of the sdparm/sg3_utils upcoming versions.
Comment 4 Pádraig Brady 2010-02-15 04:59:34 EST
Could you expand on that a bit. I really hate unnecessary options, but if it needs to be an option fair enough. Could we try RO then fall back to RW for example? Also hdparm sets RO by default, so why exactly is sdparm different. cheers.
Comment 5 Dan Horák 2010-02-15 05:17:26 EST
The long answer from Doug: T10 and T13 have been trying to converge the semantics of START/STOP for some time. Folks from Seagate are driving the effort at T10. My guess is that this problem in some form has bitten them. The executive summary is that START_STOP_UNIT in SCSI is state changing in the sense that after a stop both READ and WRITE will fail (until a start command is sent). However in the ATA world what SAT maps START_STOP_INIT(stop) to will not break subsequent READs and WRITEs, it will just slow the first one down (while it spins up the media). A related problem came up in smartmontools recently along these lines: if a ATA disk (via a SCSI device) is opened RW to collect some metadata then on close it will do a SYNCHRONIZE CACHE which will spin up an ATA disk that had earlier been spun down. Same solution: open the device RO. Since sdparm and sg_start were designed for SCSI devices my preference would be to add a '-r' (and '--readonly') option to open the given device RO.
Comment 6 Pádraig Brady 2010-02-15 05:35:06 EST
I see the issue. So with the above proposed --readonly option: --command=stop still does nothing on ATA unless it's called. That would need to be documented at least in the stop command section of the man page. What does --command=stop do in the presence of udev and SCSI. Will that also be ineffective? Would it be possible to detect if an ATA device is connected and open RO in that case, thus not requiring the -r option and associated documentation.
Comment 7 Dan Horák 2010-02-15 05:52:12 EST
I think you should discuss it with Doug directly (see http://sg.danny.cz/sg/ for contact info) and as always - patches are welcome.
Comment 8 Terje Røsten 2010-04-15 14:12:11 EDT
A new upstream release is available, seems like Doug has implemented the solution in comment #5. Could you please test the updated package: http://koji.fedoraproject.org/koji/buildinfo?buildID=167119 and see if that helps?
Comment 9 Pádraig Brady 2010-04-16 06:26:07 EDT
Comment 10 Terje Røsten 2010-04-16 15:50:31 EDT
Thanks for the feedback, I have pushed the update to F11, F12 and F13.