public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* read only scsi disk
@ 2006-02-09 17:04 Ming Zhang
  2006-02-09 19:02 ` Matthew Wilcox
  2006-02-09 19:36 ` Stefan Richter
  0 siblings, 2 replies; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 17:04 UTC (permalink / raw)
  To: linux-scsi; +Cc: Damian Pietras

Hi folks

Could anybody shed a light on this?

We are adding the support for an OSS iscsi target to support export an
iscsi disk as readonly. We set correct read only bit in sense dbd. But
we found that only when we set the removable bit, the linux will
actually check the ro bit. more detail information can be found from

http://sourceforge.net/mailarchive/forum.php?thread_id=9682261&forum_id=40837

from sd.c, it looks like removable is judged first.

             if (sdp->removable)
                   sd_read_write_protect_flag(sdkp, disk->disk_name,
                                                   buffer);


so is there special reason that we should judge removable before we see
if write protect?

thanks!

Ming



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

* Re: read only scsi disk
  2006-02-09 17:04 read only scsi disk Ming Zhang
@ 2006-02-09 19:02 ` Matthew Wilcox
  2006-02-09 19:19   ` Ming Zhang
                     ` (2 more replies)
  2006-02-09 19:36 ` Stefan Richter
  1 sibling, 3 replies; 12+ messages in thread
From: Matthew Wilcox @ 2006-02-09 19:02 UTC (permalink / raw)
  To: Ming Zhang; +Cc: linux-scsi, Damian Pietras

On Thu, Feb 09, 2006 at 12:04:07PM -0500, Ming Zhang wrote:
> We are adding the support for an OSS iscsi target to support export an
> iscsi disk as readonly. We set correct read only bit in sense dbd. But
> we found that only when we set the removable bit, the linux will
> actually check the ro bit. more detail information can be found from

Surely all iSCSI discs are removable, since anyone could unplug the
network cable at any time ...

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

* Re: read only scsi disk
  2006-02-09 19:02 ` Matthew Wilcox
@ 2006-02-09 19:19   ` Ming Zhang
  2006-02-09 19:54   ` Stefan Richter
  2006-02-10 10:35   ` Christoph Hellwig
  2 siblings, 0 replies; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 19:19 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-scsi, Damian Pietras

so fc disk is also removable, since anyone could unplug the fc cable at
any time...

so even parallel scsi disk, sata disk...

i donot think this is a good reason. ;)

ming

On Thu, 2006-02-09 at 12:02 -0700, Matthew Wilcox wrote:
> On Thu, Feb 09, 2006 at 12:04:07PM -0500, Ming Zhang wrote:
> > We are adding the support for an OSS iscsi target to support export an
> > iscsi disk as readonly. We set correct read only bit in sense dbd. But
> > we found that only when we set the removable bit, the linux will
> > actually check the ro bit. more detail information can be found from
> 
> Surely all iSCSI discs are removable, since anyone could unplug the
> network cable at any time ...


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

* RE: read only scsi disk
@ 2006-02-09 19:32 berthiaume_wayne
  2006-02-09 19:38 ` Ming Zhang
  0 siblings, 1 reply; 12+ messages in thread
From: berthiaume_wayne @ 2006-02-09 19:32 UTC (permalink / raw)
  To: mingz, matthew; +Cc: linux-scsi, daper

I seem to recall this behavior had something to do with the handling of
CD/ROM disks at one time.

Regards,
Wayne. 

-----Original Message-----
From: linux-scsi-owner@vger.kernel.org
[mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Ming Zhang
Sent: Thursday, February 09, 2006 2:19 PM
To: Matthew Wilcox
Cc: linux-scsi; Damian Pietras
Subject: Re: read only scsi disk

so fc disk is also removable, since anyone could unplug the fc cable at
any time...

so even parallel scsi disk, sata disk...

i donot think this is a good reason. ;)

ming

On Thu, 2006-02-09 at 12:02 -0700, Matthew Wilcox wrote:
> On Thu, Feb 09, 2006 at 12:04:07PM -0500, Ming Zhang wrote:
> > We are adding the support for an OSS iscsi target to support export an
> > iscsi disk as readonly. We set correct read only bit in sense dbd. But
> > we found that only when we set the removable bit, the linux will
> > actually check the ro bit. more detail information can be found from
> 
> Surely all iSCSI discs are removable, since anyone could unplug the
> network cable at any time ...

-
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] 12+ messages in thread

* Re: read only scsi disk
  2006-02-09 17:04 read only scsi disk Ming Zhang
  2006-02-09 19:02 ` Matthew Wilcox
@ 2006-02-09 19:36 ` Stefan Richter
  2006-02-09 19:41   ` Ming Zhang
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Richter @ 2006-02-09 19:36 UTC (permalink / raw)
  To: mingz; +Cc: linux-scsi, Damian Pietras

Ming Zhang wrote:
> from sd.c, it looks like removable is judged first.
> 
>              if (sdp->removable)
>                    sd_read_write_protect_flag(sdkp, disk->disk_name,
>                                                    buffer);

This has been changed in the meantime. Check the current sources.
-- 
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/

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

* RE: read only scsi disk
  2006-02-09 19:32 berthiaume_wayne
@ 2006-02-09 19:38 ` Ming Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 19:38 UTC (permalink / raw)
  To: berthiaume_wayne; +Cc: matthew, linux-scsi, daper

thx.

but if i am correct, cdrom is handled in sr while disk is handled in sd.
so they are independent issues. of course, might be same reason. :P

the key here is why sd.c need to judge write protect only for removable
disk. is there no case that a disk is read only but not removable? for
example, if later a secure disk has internal security protection and
after authentication, the allowed option is only to read? this can be
common for networked disks.

ming




On Thu, 2006-02-09 at 14:32 -0500, berthiaume_wayne@emc.com wrote:
> I seem to recall this behavior had something to do with the handling of
> CD/ROM disks at one time.
> 
> Regards,
> Wayne. 
> 
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org
> [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Ming Zhang
> Sent: Thursday, February 09, 2006 2:19 PM
> To: Matthew Wilcox
> Cc: linux-scsi; Damian Pietras
> Subject: Re: read only scsi disk
> 
> so fc disk is also removable, since anyone could unplug the fc cable at
> any time...
> 
> so even parallel scsi disk, sata disk...
> 
> i donot think this is a good reason. ;)
> 
> ming
> 
> On Thu, 2006-02-09 at 12:02 -0700, Matthew Wilcox wrote:
> > On Thu, Feb 09, 2006 at 12:04:07PM -0500, Ming Zhang wrote:
> > > We are adding the support for an OSS iscsi target to support export an
> > > iscsi disk as readonly. We set correct read only bit in sense dbd. But
> > > we found that only when we set the removable bit, the linux will
> > > actually check the ro bit. more detail information can be found from
> > 
> > Surely all iSCSI discs are removable, since anyone could unplug the
> > network cable at any time ...
> 
> -
> 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] 12+ messages in thread

* Re: read only scsi disk
  2006-02-09 19:36 ` Stefan Richter
@ 2006-02-09 19:41   ` Ming Zhang
  2006-02-09 20:57     ` Stefan Richter
  0 siblings, 1 reply; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 19:41 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux-scsi, Damian Pietras

thx, i found this was changed in at least 2.6.16-rc2.

ming



On Thu, 2006-02-09 at 20:36 +0100, Stefan Richter wrote:
> Ming Zhang wrote:
> > from sd.c, it looks like removable is judged first.
> > 
> >              if (sdp->removable)
> >                    sd_read_write_protect_flag(sdkp, disk->disk_name,
> >                                                    buffer);
> 
> This has been changed in the meantime. Check the current sources.


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

* Re: read only scsi disk
  2006-02-09 19:02 ` Matthew Wilcox
  2006-02-09 19:19   ` Ming Zhang
@ 2006-02-09 19:54   ` Stefan Richter
  2006-02-09 20:01     ` Ming Zhang
  2006-02-10 10:35   ` Christoph Hellwig
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan Richter @ 2006-02-09 19:54 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Ming Zhang, linux-scsi, Damian Pietras

Matthew Wilcox wrote:
> Surely all iSCSI discs are removable, since anyone could unplug the
> network cable at any time ...

AFAIU, sdev->removable is about the medium, not about the device. Media 
can be hot-removed, devices can be hot-unplugged. (Of course an iSCSI 
target could implement removable media too.)
-- 
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/

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

* Re: read only scsi disk
  2006-02-09 19:54   ` Stefan Richter
@ 2006-02-09 20:01     ` Ming Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 20:01 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Matthew Wilcox, linux-scsi, Damian Pietras

yes, this is more accurate. thx.

ming


On Thu, 2006-02-09 at 20:54 +0100, Stefan Richter wrote:
> Matthew Wilcox wrote:
> > Surely all iSCSI discs are removable, since anyone could unplug the
> > network cable at any time ...
> 
> AFAIU, sdev->removable is about the medium, not about the device. Media 
> can be hot-removed, devices can be hot-unplugged. (Of course an iSCSI 
> target could implement removable media too.)


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

* Re: read only scsi disk
  2006-02-09 19:41   ` Ming Zhang
@ 2006-02-09 20:57     ` Stefan Richter
  2006-02-09 21:11       ` Ming Zhang
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Richter @ 2006-02-09 20:57 UTC (permalink / raw)
  To: mingz; +Cc: linux-scsi, Damian Pietras

Ming Zhang wrote:
> thx, i found this was changed in at least 2.6.16-rc2.

> On Thu, 2006-02-09 at 20:36 +0100, Stefan Richter wrote:
>>Ming Zhang wrote:
>>>from sd.c, it looks like removable is judged first.
>>>
>>>             if (sdp->removable)
>>>                   sd_read_write_protect_flag(sdkp, disk->disk_name,
>>>                                                   buffer);
>>
>>This has been changed in the meantime. Check the current sources.

PS: It was discussed and changed in December.
http://marc.theaimsgroup.com/?t=113406630600001
http://marc.theaimsgroup.com/?l=linux-scsi&m=113414617020021
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=38d76df2f5483478dee803cb6e39da5e506a6643
(Note: Commit date refers to James' tree. It went into Linus' tree later 
after release of 2.6.15 but before 2.6.16-rc1.)
-- 
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/

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

* Re: read only scsi disk
  2006-02-09 20:57     ` Stefan Richter
@ 2006-02-09 21:11       ` Ming Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Ming Zhang @ 2006-02-09 21:11 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux-scsi, Damian Pietras

thanks!

ming

On Thu, 2006-02-09 at 21:57 +0100, Stefan Richter wrote:
> Ming Zhang wrote:
> > thx, i found this was changed in at least 2.6.16-rc2.
> 
> > On Thu, 2006-02-09 at 20:36 +0100, Stefan Richter wrote:
> >>Ming Zhang wrote:
> >>>from sd.c, it looks like removable is judged first.
> >>>
> >>>             if (sdp->removable)
> >>>                   sd_read_write_protect_flag(sdkp, disk->disk_name,
> >>>                                                   buffer);
> >>
> >>This has been changed in the meantime. Check the current sources.
> 
> PS: It was discussed and changed in December.
> http://marc.theaimsgroup.com/?t=113406630600001
> http://marc.theaimsgroup.com/?l=linux-scsi&m=113414617020021
> http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=38d76df2f5483478dee803cb6e39da5e506a6643
> (Note: Commit date refers to James' tree. It went into Linus' tree later 
> after release of 2.6.15 but before 2.6.16-rc1.)


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

* Re: read only scsi disk
  2006-02-09 19:02 ` Matthew Wilcox
  2006-02-09 19:19   ` Ming Zhang
  2006-02-09 19:54   ` Stefan Richter
@ 2006-02-10 10:35   ` Christoph Hellwig
  2 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2006-02-10 10:35 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Ming Zhang, linux-scsi, Damian Pietras

On Thu, Feb 09, 2006 at 12:02:25PM -0700, Matthew Wilcox wrote:
> On Thu, Feb 09, 2006 at 12:04:07PM -0500, Ming Zhang wrote:
> > We are adding the support for an OSS iscsi target to support export an
> > iscsi disk as readonly. We set correct read only bit in sense dbd. But
> > we found that only when we set the removable bit, the linux will
> > actually check the ro bit. more detail information can be found from
> 
> Surely all iSCSI discs are removable, since anyone could unplug the
> network cable at any time ...

The removable flags means a removeable medium.  All devices are treated as
beeing able to just go away when the transport is disconnected or the HBA
removed.


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

end of thread, other threads:[~2006-02-10 10:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-09 17:04 read only scsi disk Ming Zhang
2006-02-09 19:02 ` Matthew Wilcox
2006-02-09 19:19   ` Ming Zhang
2006-02-09 19:54   ` Stefan Richter
2006-02-09 20:01     ` Ming Zhang
2006-02-10 10:35   ` Christoph Hellwig
2006-02-09 19:36 ` Stefan Richter
2006-02-09 19:41   ` Ming Zhang
2006-02-09 20:57     ` Stefan Richter
2006-02-09 21:11       ` Ming Zhang
  -- strict thread matches above, loose matches on Subject: below --
2006-02-09 19:32 berthiaume_wayne
2006-02-09 19:38 ` Ming Zhang

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