Skip to contentSkip to conversation

scsi-block: Add qdev error properties

PATCH Superseded Fam Zheng 2 participants 4 messages Aug 17, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 scsi-block: Add qdev error properties

This makes the werror/rerror options available on the scsi-block device, to allow user specify error handling policy in the same way as scsi-hd etc.

---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
index 5f1e5e8070..27d917f7c3 100644
@@ -2972,6 +2972,7 @@ static const TypeInfo scsi_cd_info = {
 
 #ifdef __linux__
 static Property scsi_block_properties[] = {
+    DEFINE_BLOCK_ERROR_PROPERTIES(SCSIDiskState, qdev.conf),         \
     DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk),
     DEFINE_PROP_END_OF_LIST(),
 };
Signature · 1 line
2.13.4
#1 lore raw
Quoted 5 lines · Fam Zheng

This makes the werror/rerror options available on the scsi-block device, to allow user specify error handling policy in the same way as scsi-hd etc.

I'm not sure this is enough, because you would only obey the rerror/werror action if ioctl fails, not if the ioctl succeeds but the command fails (the "r->status && *r->status" conditional in scsi_disk_req_check_error).

Paolo

Quoted 17 lines
---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
index 5f1e5e8070..27d917f7c3 100644
@@ -2972,6 +2972,7 @@ static const TypeInfo scsi_cd_info = {
 
 #ifdef __linux__
 static Property scsi_block_properties[] = {
+    DEFINE_BLOCK_ERROR_PROPERTIES(SCSIDiskState, qdev.conf),         \
     DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk),
     DEFINE_PROP_END_OF_LIST(),
 };
author
#2 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 5 lines · Fam Zheng

This makes the werror/rerror options available on the scsi-block device, to allow user specify error handling policy in the same way as scsi-hd etc.

I'm not sure this is enough, because you would only obey the rerror/werror action if ioctl fails, not if the ioctl succeeds but the command fails (the "r->status && *r->status" conditional in scsi_disk_req_check_error).

Yes, I missed that. Why isn't scsi_handle_rw_error called in that if block currently?

Fam

#3 lore raw
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Paolo Bonzini
Quoted 5 lines · Fam Zheng

This makes the werror/rerror options available on the scsi-block device, to allow user specify error handling policy in the same way as scsi-hd etc.

Quoted 7 lines
Quoted 4 lines

I'm not sure this is enough, because you would only obey the rerror/werror action if ioctl fails, not if the ioctl succeeds but the command fails (the "r->status && *r->status" conditional in scsi_disk_req_check_error).

Yes, I missed that. Why isn't scsi_handle_rw_error called in that if block currently?

A recursive answer is because scsi-block doesn't have rerror and werror (and it's the only one that sets r->status, see scsi_block_dma_command).

More precisely, scsi_handle_rw_error more or less assumes error != 0 (see the switch statement and blk_error_action), so some other changes are needed to cover that case---at least not overwrite the sense and ensure something sensible comes out of the QMP event.

Paolo