Re: [Re: Linux 2.6.26-rc2] Write protect on on

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Boaz Harrosh
Date: Sunday, May 18, 2008 - 9:27 am

Alan Stern wrote:

Do you mean this diff below:

@@ -796,133 +789,133 @@ kernel: usb-storage: *** thread awakened
 kernel: usb-storage: Command MODE_SENSE (6 bytes)
 kernel: usb-storage:  1a 00 3f 00 c0 00
 kernel: usb-storage: Bulk Command S 0x43425355 T 0x4 L 192 F 128 Trg 0 LUN 0 CL 6
 kernel: usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
 kernel: usb-storage: Status code 0; transferred 31/31
 kernel: usb-storage: -- transfer complete
 kernel: usb-storage: Bulk command transfer result=0
 kernel: usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries
 kernel: usb-storage: Status code -32; transferred 0/192
 kernel: usb-storage: clearing endpoint halt for pipe 0xc0008480
 kernel: usb-storage: usb_stor_control_msg: rq=01 rqtype=02 value=0000 index=81 len=0
 kernel: usb-storage: usb_stor_clear_halt: result = 0
 kernel: usb-storage: Bulk data transfer result 0x2
 kernel: usb-storage: Attempting to get CSW...
 kernel: usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
 kernel: usb-storage: Status code 0; transferred 13/13
 kernel: usb-storage: -- transfer complete
 kernel: usb-storage: Bulk status result = 0
 kernel: usb-storage: Bulk Status S 0x53425355 T 0x4 R 192 Stat 0x0
 kernel: usb-storage: scsi cmd done, result=0x0
 kernel: usb-storage: *** thread sleeping.
-kernel: sd 2:0:0:0: [sda] Write Protect is off
-kernel: sd 2:0:0:0: [sda] Mode Sense: 00 00 00 00
+kernel: sd 2:0:0:0: [sda] Write Protect is on
+kernel: sd 2:0:0:0: [sda] Mode Sense: 09 50 f8 af
 kernel: sd 2:0:0:0: [sda] Assuming drive cache: write through
 kernel: usb-storage: queuecommand called

("+" is the new kernel and "-" the older one)

It looks like it used to be the same exact return and everything only that at
old kernel the 4 bytes used to be zero and now they are not.

So It looks to me that it never used to work (Data was never actually read
from device) but by luck, the garbage data used to be a better default 
"Write Protect is off"

I do not think it is legal in scsi to return "Nothing was read" with no
error condition. You are probably right that we do not at all check resid
if status is 0, even though short reads are allowed with out error status
in some cases, as per command. But this is not the case here here nothing
was read at all, status must be returned. Or even worse if this command 
is mandatory by scsi but not supported by some USB devices then it will
have to be emulated by usb_storage.

My $0.017
Boaz
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Re: Linux 2.6.26-rc2] Write protect on on, Maciej Rutecki, (Fri May 16, 7:55 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Alan Stern, (Fri May 16, 6:03 pm)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Maciej Rutecki, (Fri May 16, 11:59 pm)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Alan Stern, (Sat May 17, 6:49 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Boaz Harrosh, (Sun May 18, 9:27 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Alan Stern, (Mon May 19, 8:18 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Boaz Harrosh, (Mon May 19, 9:08 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Linus Torvalds, (Mon May 19, 9:36 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Boaz Harrosh, (Mon May 19, 10:03 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Linus Torvalds, (Mon May 19, 10:27 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Boaz Harrosh, (Mon May 19, 10:45 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Matthew Wilcox, (Mon May 19, 11:16 am)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, Alan Stern, (Mon May 19, 12:17 pm)
Re: [Re: Linux 2.6.26-rc2] Write protect on on, James Bottomley, (Thu May 22, 1:23 am)