iscsi: Refuse to open as writable if the LUN is write protected
commitc1d4096b0f033d0a52c542f0948403783c3682e9
authorFam Zheng <famz@redhat.com>
Thu, 30 Oct 2014 11:23:46 +0000 (30 19:23 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 31 Oct 2014 10:29:02 +0000 (31 11:29 +0100)
tree6fcc7af9f17eef8bc671ac615faa265291510e32
parent076893d3d06fe8642b8912591b9222bcb81f85aa
iscsi: Refuse to open as writable if the LUN is write protected

Before, when a write protected iSCSI target is attached as scsi-disk
with BDRV_O_RDWR, we report it as writable, while in fact all writes
will fail.

One way to improve this is to report write protect flag as true to
guest, but a even better way is to refuse using a write protected LUN to
guest.

Target write protect flag is checked with a mode sense query.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block/iscsi.c