* RE: Write-protect checks
@ 2005-12-08 18:32 Salyzyn, Mark
2005-12-08 23:25 ` Douglas Gilbert
2005-12-09 16:34 ` [PATCH] Always do write-protect check Alan Stern
0 siblings, 2 replies; 6+ messages in thread
From: Salyzyn, Mark @ 2005-12-08 18:32 UTC (permalink / raw)
To: Alan Stern, SCSI development list, Alan Cox; +Cc: Dmitry Antipov
I have an interest in this being checked for fixed media as well, we
want to expose the underlying physical array components, but read &
write protected to protect the array contents. Christoph asked for us to
use the scsi layer for this check rather than spoofing it in the driver.
The other alternative is to add yet another device flag to enforce this.
Sincerely -- Mark Salyzyn
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org
> [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Alan Stern
> Sent: Thursday, December 08, 2005 1:22 PM
> To: SCSI development list; Alan Cox
> Cc: Dmitry Antipov
> Subject: Write-protect checks
>
>
> On Thu, 8 Dec 2005, Alan Cox wrote:
>
> > On Iau, 2005-12-08 at 11:00 -0500, Alan Stern wrote:
> > > module parameter. For some reason (don't ask me why -- I
> don't know) the
> > > SCSI core doesn't check a disk device's write-protect
> status unless the
> > > device is marked as removable.
> >
> > Have you asked the scsi maintainers why this occurs. Having
> had a quick
> > look over the specs I have here I can't see why this is done either.
>
> No, I haven't.
>
> Okay guys. Does anyone know why sd.c calls
> sd_read_write_protect_flag
> only for devices with removable media?
>
> Alan Stern
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Write-protect checks
2005-12-08 18:32 Write-protect checks Salyzyn, Mark
@ 2005-12-08 23:25 ` Douglas Gilbert
2005-12-09 16:34 ` [PATCH] Always do write-protect check Alan Stern
1 sibling, 0 replies; 6+ messages in thread
From: Douglas Gilbert @ 2005-12-08 23:25 UTC (permalink / raw)
To: Salyzyn, Mark; +Cc: Alan Stern, SCSI development list, Alan Cox, Dmitry Antipov
Salyzyn, Mark wrote:
> I have an interest in this being checked for fixed media as well, we
> want to expose the underlying physical array components, but read &
> write protected to protect the array contents.
Mark,
How does a device indicate that it is read protected?
[apart from bouncing READ commands with data protect]
SBC-3 has no similar mechanism to the WP bit in the
device specific parameter field returned by MODE SENSE.
IMO sd should check and respect the WP bit for all
devices (whether removable or not). If the sd driver
finds out that a device is read and write protected,
perhaps it should detach itself.
Doug Gilbert
Christoph asked for us to
> use the scsi layer for this check rather than spoofing it in the driver.
>
> The other alternative is to add yet another device flag to enforce this.
>
> Sincerely -- Mark Salyzyn
>
>
>>-----Original Message-----
>>From: linux-scsi-owner@vger.kernel.org
>>[mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Alan Stern
>>Sent: Thursday, December 08, 2005 1:22 PM
>>To: SCSI development list; Alan Cox
>>Cc: Dmitry Antipov
>>Subject: Write-protect checks
>>
>>
>>On Thu, 8 Dec 2005, Alan Cox wrote:
>>
>>
>>>On Iau, 2005-12-08 at 11:00 -0500, Alan Stern wrote:
>>>
>>>>module parameter. For some reason (don't ask me why -- I
>>
>>don't know) the
>>
>>>>SCSI core doesn't check a disk device's write-protect
>>
>>status unless the
>>
>>>>device is marked as removable.
>>>
>>>Have you asked the scsi maintainers why this occurs. Having
>>
>>had a quick
>>
>>>look over the specs I have here I can't see why this is done either.
>>
>>No, I haven't.
>>
>>Okay guys. Does anyone know why sd.c calls
>>sd_read_write_protect_flag
>>only for devices with removable media?
>>
>>Alan Stern
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe
>>linux-scsi" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Always do write-protect check
2005-12-08 18:32 Write-protect checks Salyzyn, Mark
2005-12-08 23:25 ` Douglas Gilbert
@ 2005-12-09 16:34 ` Alan Stern
2005-12-09 17:51 ` James Bottomley
1 sibling, 1 reply; 6+ messages in thread
From: Alan Stern @ 2005-12-09 16:34 UTC (permalink / raw)
To: James Bottomley
Cc: SCSI development list, Salyzyn, Mark, Alan Cox, Dmitry Antipov
James:
Since nobody has offered an explanation for why the sd driver makes a
write-protect check only for devices with removable media, I'm submitting
this patch (as620) to get rid of the removable-media test.
Alan Stern
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
Index: usb-2.6/drivers/scsi/sd.c
===================================================================
--- usb-2.6.orig/drivers/scsi/sd.c
+++ usb-2.6/drivers/scsi/sd.c
@@ -1509,9 +1509,7 @@ static int sd_revalidate_disk(struct gen
*/
if (sdkp->media_present) {
sd_read_capacity(sdkp, disk->disk_name, buffer);
- if (sdp->removable)
- sd_read_write_protect_flag(sdkp, disk->disk_name,
- buffer);
+ sd_read_write_protect_flag(sdkp, disk->disk_name, buffer);
sd_read_cache_type(sdkp, disk->disk_name, buffer);
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Always do write-protect check
2005-12-09 16:34 ` [PATCH] Always do write-protect check Alan Stern
@ 2005-12-09 17:51 ` James Bottomley
0 siblings, 0 replies; 6+ messages in thread
From: James Bottomley @ 2005-12-09 17:51 UTC (permalink / raw)
To: Alan Stern; +Cc: SCSI development list, Salyzyn, Mark, Alan Cox, Dmitry Antipov
On Fri, 2005-12-09 at 11:34 -0500, Alan Stern wrote:
> Since nobody has offered an explanation for why the sd driver makes a
> write-protect check only for devices with removable media, I'm submitting
> this patch (as620) to get rid of the removable-media test.
OK ... I'll put this in scsi-misc for post 2.6.15. I suspect the reason
is that many devices get confused or lie about it, but there's only one
sure way to ascertain if this is true or not ...
If it turns out to be a problem, I'll back it out before 2.6.16.
James
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <453E33D54126A643A9757AFD91EEBB3402409ACA@CXOEXC12.AMERICAS.CPQCORP.NET>]
* RE: Write-protect checks
[not found] <453E33D54126A643A9757AFD91EEBB3402409ACA@CXOEXC12.AMERICAS.CPQCORP.NET>
@ 2005-12-08 19:00 ` Alan Stern
0 siblings, 0 replies; 6+ messages in thread
From: Alan Stern @ 2005-12-08 19:00 UTC (permalink / raw)
To: Fiala, Stefan; +Cc: SCSI development list, Alan Cox, Dmitry Antipov
On Thu, 8 Dec 2005, Fiala, Stefan wrote:
> The flag is set when the kernel/module is loaded.
No it isn't.
> For all but removeable the device must disappear/reappear
> Which fixes the flag.
No it doesn't. The flag does not get set if the media is not removable.
Here's the code from sd.c:sd_revalidate_disk():
if (sdkp->media_present) {
sd_read_capacity(sdkp, disk->disk_name, buffer);
if (sdp->removable)
sd_read_write_protect_flag(sdkp, disk->disk_name,
buffer);
sd_read_cache_type(sdkp, disk->disk_name, buffer);
}
That's the only place where sd_read_write_protect_flag gets called, so it
never is called if sdp->removable is clear.
> Leaving removeables, that on user interaction, can change.
> For instance:
> On an RW-optical [use sd], eject current cartridge, flip wrt-prot tab,
> Re-insert. Unless a user were accessing during this sequence
> [sounds painful] the state of the WP bit would silently change.
> Hence the revalidate on open if its removeable.
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1134064043.17102.43.camel@localhost.localdomain>]
* Write-protect checks
[not found] <1134064043.17102.43.camel@localhost.localdomain>
@ 2005-12-08 18:22 ` Alan Stern
0 siblings, 0 replies; 6+ messages in thread
From: Alan Stern @ 2005-12-08 18:22 UTC (permalink / raw)
To: SCSI development list, Alan Cox; +Cc: Dmitry Antipov
On Thu, 8 Dec 2005, Alan Cox wrote:
> On Iau, 2005-12-08 at 11:00 -0500, Alan Stern wrote:
> > module parameter. For some reason (don't ask me why -- I don't know) the
> > SCSI core doesn't check a disk device's write-protect status unless the
> > device is marked as removable.
>
> Have you asked the scsi maintainers why this occurs. Having had a quick
> look over the specs I have here I can't see why this is done either.
No, I haven't.
Okay guys. Does anyone know why sd.c calls sd_read_write_protect_flag
only for devices with removable media?
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-12-09 17:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 18:32 Write-protect checks Salyzyn, Mark
2005-12-08 23:25 ` Douglas Gilbert
2005-12-09 16:34 ` [PATCH] Always do write-protect check Alan Stern
2005-12-09 17:51 ` James Bottomley
[not found] <453E33D54126A643A9757AFD91EEBB3402409ACA@CXOEXC12.AMERICAS.CPQCORP.NET>
2005-12-08 19:00 ` Write-protect checks Alan Stern
[not found] <1134064043.17102.43.camel@localhost.localdomain>
2005-12-08 18:22 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox