Re: [PATCH 04/17] scsi_dh_alua: Improve error handling

Bart Van Assche
2015-05-07T11:48:42Z

On 05/04/15 14:42, Hannes Reinecke wrote:
> @@ -161,12 +164,12 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h,
> rq->sense_len = h->senselen = 0;
>
> err = blk_execute_rq(rq->q, NULL, rq, 1);
> - if (err == -EIO) {
> - sdev_printk(KERN_INFO, sdev,
> - "%s: rtpg failed with %x\n",
> - ALUA_DH_NAME, rq->errors);
> + if (err < 0) {
> + if (!rq->errors)
> + err = DID_ERROR << 16;
> + else
> + err = rq->errors;
> h->senselen = rq->sense_len;
> - err = SCSI_DH_IO;
> }
> blk_put_request(rq);
> done:

Running the grep query "->errors = " over the Linux kernel source tree
shows that sometimes a SCSI error code is written into that field and
sometimes a negative error code. Does this mean that the test
!rq->errors should be modified into !rq->errors &&
!IS_ERR_VALUE(rq->errors) ?

Bart.