Skip to contentSkip to conversation

read only scsi disk

DISCUSSION Ming Zhang 4 participants 10 messages Feb 9, 2006 – Feb 10, 2006 SCSI

lore
Share & tools
lore

Ming Zhang

author
#0 lore raw

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

#1 lore raw
Quoted 4 lines · Ming Zhang

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 ...

author
#2 lore raw

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

Quoted 8 lines · Matthew Wilcox
Quoted 4 lines · Ming Zhang

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 ...

#3 lore raw
In reply to Matthew Wilcox
Quoted 2 lines · Matthew Wilcox

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.)

Signature · 3 lines
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/
author
#4 lore raw

yes, this is more accurate. thx.

ming

Quoted 7 lines · Stefan Richter
Quoted 2 lines · Matthew Wilcox

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.)

#5 lore raw
In reply to Matthew Wilcox
Quoted 8 lines · Matthew Wilcox
Quoted 4 lines · Ming Zhang

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.

#6 lore raw
In reply to Ming Zhang
Quoted 5 lines · Ming Zhang

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.

Signature · 3 lines
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/
author
#7 lore raw

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

ming

Quoted 8 lines · Stefan Richter
Quoted 5 lines · Ming Zhang

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.

#8 lore raw
Quoted 11 lines · Ming Zhang

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

Quoted 8 lines · Stefan Richter
Quoted 5 lines · Ming Zhang

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.)

Signature · 3 lines
Stefan Richter
-=====-=-==- --=- -=--=
http://arcgraph.de/sr/
author
#9 lore raw

thanks!

ming

Quoted 19 lines · Stefan Richter
Quoted 11 lines · Ming Zhang

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

Quoted 8 lines · Stefan Richter
Quoted 5 lines · Ming Zhang

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.)