public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* SYNCHRONIZE CACHE command from sd on close
@ 2010-02-15 13:03 Douglas Gilbert
  2010-02-15 13:25 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Douglas Gilbert @ 2010-02-15 13:03 UTC (permalink / raw)
  To: SCSI development list

Recently, judging from error reports reaching me
from smartmontools, sdparm and sg_start, something
changed in the sd driver associated with the
SYNCHRONIZE CACHE command it issues when a device
is closed.

That only seems to happen when the device is opened
RW and it exposes a nasty difference between the
semantics of spinning up and down ATA disks compared
to SCSI disks.

If you send SYNCHRONIZE CACHE to a SATL then the ATA
disk behind it will be spun up if it happened to be
spun down. Send that command to a SCSI disk and you
will get an error message (sense) indicating that
you need to do START_STOP_UNIT(start) first.

One manifestation of this problem is that:
     sdparm -C stop <ata_disk_via_sd>
doesn't work. Being a SCSI utility it opens the sd
device RW reflecting that the START_STOP_UNIT to
a SCSI disk is potentially state changing (in the
sense that subsequent READs and WRITEs may fail).
But since we have a ATA disk then the SYNCHRONIZE
CACHE on close spins up the disk, defeating the
attempt to spin it down.

Now I'm playing lots of tricks in sdparm to get
around this but I think the correct solution is
for the sd driver to only send the SYNCHRONIZE
CACHE command to a device on close if something
has been written to it.

Doug Gilbert

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

end of thread, other threads:[~2010-02-19 11:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15 13:03 SYNCHRONIZE CACHE command from sd on close Douglas Gilbert
2010-02-15 13:25 ` Christoph Hellwig
2010-02-15 13:51   ` Douglas Gilbert
2010-02-15 22:48     ` Christoph Hellwig
2010-02-19  0:20       ` Douglas Gilbert
2010-02-19  8:04         ` Christoph Hellwig
2010-02-19 11:56           ` Douglas Gilbert

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