From: Douglas Gilbert <dgilbert@interlog.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: SCSI development list <linux-scsi@vger.kernel.org>,
Dan Hor??k <dhorak@redhat.com>
Subject: Re: SYNCHRONIZE CACHE command from sd on close
Date: Fri, 19 Feb 2010 12:56:46 +0100 [thread overview]
Message-ID: <4B7E7C7E.5050701@interlog.com> (raw)
In-Reply-To: <20100219080407.GA21905@infradead.org>
Christoph Hellwig wrote:
> On Fri, Feb 19, 2010 at 01:20:25AM +0100, Douglas Gilbert wrote:
>> So send a START_STOP_UNIT(stop) through the SG_IO
>> ioctl on a sd device opened RW and as a bonus get
>> three INQUIRYs (one standard, two VPD pages) and 5 READ
>> commands!
>>
>> If the device is SCSI (as the scsi_debug driver is
>> simulating) then those READs fail because the drive
>> is stopped. However if that is an ATA disk behind a
>> SAT layer, then the disk will be spun up. That defeats
>> the purpose of the pass-though, especially when it
>> is being used to spin down the disk.
>>
>> My guess, reviewing the bug reports flowing into me is
>> that this nonsense started around lk 2.6.29 .
>
> We should never send INQUIRY or READ commands from the kernel
> in response to opening a device. But the combination sounds
> like something udev might be doing for it's stable device
> indentifier and manual partition scan because I don't trust
> the kernel thing. Can you check if these commands come from
> udev or one of the realted tools (hal, device-kit-blah, udisks
> whatever it is called today)
Adding some sleep()s to sg_start it seems that all nasty
stuff gets sent to the device synchronized with the close()
of the /dev/sd* file descriptor (not the open() ).
The sg_start sequence is:
a) fd = open("/dev/sdb", O_RDWR | O_NOBLOCK)
b) ioctl(fd, SG_IO, <START_STOP_UNIT(stop) command>)
c) close(fd)
a) sends no SCSI commands to the device
b) sends the START_STOP_UNIT(stop) only
c) sends 3 INQUIRYs and 5 READs !?
prev parent reply other threads:[~2010-02-19 11:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B7E7C7E.5050701@interlog.com \
--to=dgilbert@interlog.com \
--cc=dhorak@redhat.com \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox