linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: patmans@us.ibm.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [usb-storage] Re: [PATCH] fix Sony USB mass storage - pass larger receive buffer
Date: 17 Nov 2003 16:36:56 -0700	[thread overview]
Message-ID: <1069112216.5270.54.camel@patrh9> (raw)
In-Reply-To: <20031117140032.A21143@beaverton.ibm.com>

> If you want to test with your read only media, just use the dev flags:
> 
> 	echo "vendor:model:0x4000" > /proc/scsi/device_info 
> 
> Then add your device, see if it comes back as writable, and try to mount
> or write it, and compare without the above (you can't remove device_info
> entry without rebooting or rmmod-ing scsi).

Success!

Yes I see, same for sd as for sr/ide-cd, we can defeat write-protect in
2.6.0-test9 by root privilege so that then we can fail to write thru dd
or thru mount without bothering to notify the user loudly.

To prepare I remember I tried:

1) Make device writable.
2) mkfs
3) sync
4) Unplug.
5) Make device read-only.
6) Plug back in.

Thereafter I saw such tty logs as:

$ sudo sg_scan -i
/dev/sg0: scsi0 channel=0 id=0 lun=0 [em]  type=0
    LEXAR     DIGITAL FILM      /W1. [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
$
$ v="LEXAR   "; m="DIGITAL FILM    "; echo "$v:$m:0x4000" | sudo dd of=/proc/scsi/device_info
0+1 records in
0+1 records out
$
$ sudo dd of=/dev/sda1 if=/dev/zero bs=512 count=1
dd: opening `/dev/sda1': Read-only file system
$
$ sudo modprobe -r usb-storage
$ sudo modprobe usb-storage
$
$ sudo dd of=/dev/sda1 if=/dev/zero bs=512 count=1
1+0 records in
1+0 records out
$
$ dmesg | tail
usb-storage:  -y "00 00 00 00 00 00"
usb-storage:  -i 0x1000 -y "28 00 00 00 00 20 00 00 08 00"
usb-storage:  -o 0x1000 -y "2A 00 00 00 00 20 00 00 08 00"
SCSI error : <4 0 0 0> return code = 0x8000002
Info fld=0x0, Current sda: sense = f0  7
ASC=27 ASCQ= 0
Raw sense data:0xf0 0x00 0x07 0x00 0x00 0x00 0x00 0x0b 0x00 0x00 0x00 0x00 0x27 0x00 0x00 0x00 0x00 0x00 0x00
end_request: I/O error, dev sda, sector 32
Buffer I/O error on device sda1, logical block 0
lost page write due to I/O error on sda1
$
$ sudo mount /dev/sda1 /mnt/sda1
$ ls /mnt/sda1
lost+found
$ sudo umount /mnt/sda1
$ dmesg | tail
 [<c010b509>] sysenter_past_esp+0x52/0x71
 
usb-storage:  -o 0x400 -y "2A 00 00 00 00 22 00 00 02 00"
SCSI error : <4 0 0 0> return code = 0x8000002
Info fld=0x0, Current sda: sense = f0  7
ASC=27 ASCQ= 0
Raw sense data:0xf0 0x00 0x07 0x00 0x00 0x00 0x00 0x0b 0x00 0x00 0x00 0x00 0x27 0x00 0x00 0x00 0x00 0x00 0x00
end_request: I/O error, dev sda, sector 34
Buffer I/O error on device sda1, logical block 1
lost page write due to I/O error on sda1
$

> [Trimmed the cc line]

Ack.

I concluded by trying:

$ egrep 'CONFIG_SCSI.*m' .config
CONFIG_SCSI=m
CONFIG_SCSI_DEBUG=m
$

Also I was helped by the dmesg:

scsi_strcpy_devinfo: vendor string 'LEXAR     ' is too long
scsi_strcpy_devinfo: model string 'DIGITAL FILM      ' is too long

And I failed to immediately grok `logger`.  Instead I correlated my
shell commands with my dmesg by patching usb-storage to trace cdb's. 

Pat LaVarre



  reply	other threads:[~2003-11-17 23:37 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12 23:50 [PATCH] fix Sony USB mass storage - pass larger receive buffer Patrick Mansfield
2003-11-13  0:09 ` Matthew Dharm
2003-11-13  0:13   ` Patrick Mansfield
2003-11-13  0:44     ` Patrick Mansfield
2003-11-13  1:56       ` Matthew Dharm
2003-11-13 14:54         ` [usb-storage] " Alan Stern
2003-11-13 16:21           ` Pat LaVarre
2003-11-13 17:09             ` Alan Stern
2003-11-13 17:24               ` Pat LaVarre
2003-11-13 18:04                 ` Patrick Mansfield
2003-11-13 18:15                   ` Pat LaVarre
2003-11-13 18:22                     ` Pat LaVarre
2003-11-13 18:26                       ` Pat LaVarre
2003-11-13 18:37                         ` Pat LaVarre
2003-11-13 19:13                           ` Matthew Dharm
2003-11-13 19:30                             ` Pat LaVarre
2003-11-13 22:03                               ` Alan Stern
2003-11-13 23:40                                 ` Pat LaVarre
2003-11-13 23:51                                   ` Dmitri Katchalov
2003-11-14  0:16                                     ` Pat LaVarre
2003-11-14  1:04                                   ` Matthew Dharm
2003-11-14  1:10                                     ` Pat LaVarre
2003-11-14  1:13                                       ` Matthew Dharm
2003-11-13 22:01                 ` Alan Stern
2003-11-13 23:37                   ` Pat LaVarre
2003-11-14  0:24                     ` Patrick Mansfield
2003-11-14  1:54                       ` Pat LaVarre
2003-11-14  2:08                         ` Matthew Dharm
2003-11-14  2:24                           ` Pat LaVarre
2003-11-17 21:38                       ` Pat LaVarre
2003-11-17 22:00                         ` Patrick Mansfield
2003-11-17 23:36                           ` Pat LaVarre [this message]
2003-11-14  1:03                     ` Matthew Dharm
2003-11-13 23:44                   ` Pat LaVarre
2003-11-14  0:13                     ` Dmitri Katchalov
2003-11-14  0:55                       ` Pat LaVarre
2003-11-14  1:13                       ` Matthew Dharm
2003-11-14  2:02                         ` Pat LaVarre
2003-11-14  2:10                       ` Pat LaVarre
2003-11-14  2:19                         ` Matthew Dharm
2003-11-14  2:38                           ` [usb-storage] mode sense blacklist how Pat LaVarre
2003-11-14  2:44                             ` Matthew Dharm
2003-11-14 17:27                               ` Pat LaVarre
2003-11-14 17:57                                 ` Pat LaVarre
2003-11-14  3:11                             ` Dmitri Katchalov
2003-11-14 19:41                               ` Pat LaVarre
     [not found]                                 ` <20031114153607.A7207@beaverton.ibm.com>
     [not found]                                   ` <20031116121039.A13224@beaverton.ibm.com>
2003-11-17 20:14                                     ` Pat LaVarre
2003-11-19 12:55                                 ` Dmitri Katchalov
2003-11-19 16:34                                   ` Pat LaVarre
2003-11-19 17:02                                   ` Pat LaVarre
2003-11-19 23:34                                     ` Douglas Gilbert
2003-11-20 16:32                                       ` Pat LaVarre
2003-11-21  1:17                                         ` SG_IO ioctl (was: mode sense blacklist how) Douglas Gilbert
2003-11-21  3:18                                           ` Willem Riede
2003-11-21 20:51                                           ` Pat LaVarre
2003-11-28 17:07                                             ` Pat LaVarre
2003-11-28 17:14                                               ` Pat LaVarre
2003-11-28 17:31                                               ` Pat LaVarre
2003-11-28 17:09                                             ` Pat LaVarre
2003-11-21 21:29                                           ` Pat LaVarre
2003-11-20 14:06                                     ` [usb-storage] mode sense blacklist how Dmitri Katchalov
2003-11-20 15:57                                       ` Pat LaVarre
2003-11-14  1:06                     ` [usb-storage] Re: [PATCH] fix Sony USB mass storage - pass larger receive buffer Matthew Dharm
2003-11-14 16:14                     ` Alan Stern
2003-11-14 17:29                       ` Matthew Dharm
2003-11-14 17:50                       ` Pat LaVarre
2003-11-14  2:02 ` Douglas Gilbert
2003-11-14 21:45   ` [usb-storage] " Pat LaVarre
  -- strict thread matches above, loose matches on Subject: below --
2003-11-14  2:25 Andries.Brouwer

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=1069112216.5270.54.camel@patrh9 \
    --to=p.lavarre@ieee.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).