Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit febd7a5c authored by Alan D. Brunelle's avatar Alan D. Brunelle Committed by Jens Axboe
Browse files

Commands needing to be retried require a complete re-initialization.

The test-unit-ready portion of this patch was causing boots to fail on
my test machine (as in http://lkml.org/lkml/2008/12/5/161

). With this
patch in place, the system is booting reliably.

Mike Anderson found the same problem in the hp_hw_start_stop code,
and I applied the same solution in cdrom_read_cdda_bpc.

Signed-off-by: default avatarAlan D. Brunelle <alan.brunelle@hp.com>
Cc: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 6c34bc29
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -2081,10 +2081,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
	if (!q)
	if (!q)
		return -ENXIO;
		return -ENXIO;


	rq = blk_get_request(q, READ, GFP_KERNEL);
	if (!rq)
		return -ENOMEM;

	cdi->last_sense = 0;
	cdi->last_sense = 0;


	while (nframes) {
	while (nframes) {
@@ -2096,9 +2092,17 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,


		len = nr * CD_FRAMESIZE_RAW;
		len = nr * CD_FRAMESIZE_RAW;


		rq = blk_get_request(q, READ, GFP_KERNEL);
		if (!rq) {
			ret = -ENOMEM;
			break;
		}

		ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL);
		ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL);
		if (ret)
		if (ret) {
			blk_put_request(rq);
			break;
			break;
		}


		rq->cmd[0] = GPCMD_READ_CD;
		rq->cmd[0] = GPCMD_READ_CD;
		rq->cmd[1] = 1 << 2;
		rq->cmd[1] = 1 << 2;
@@ -2124,6 +2128,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,


		if (blk_rq_unmap_user(bio))
		if (blk_rq_unmap_user(bio))
			ret = -EFAULT;
			ret = -EFAULT;
		blk_put_request(rq);


		if (ret)
		if (ret)
			break;
			break;
@@ -2133,7 +2138,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
		ubuf += len;
		ubuf += len;
	}
	}


	blk_put_request(rq);
	return ret;
	return ret;
}
}


+8 −4
Original line number Original line Diff line number Diff line
@@ -107,6 +107,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
	struct request *req;
	struct request *req;
	int ret;
	int ret;


retry:
	req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO);
	req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO);
	if (!req)
	if (!req)
		return SCSI_DH_RES_TEMP_UNAVAIL;
		return SCSI_DH_RES_TEMP_UNAVAIL;
@@ -121,7 +122,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
	memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE);
	memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE);
	req->sense_len = 0;
	req->sense_len = 0;


retry:
	ret = blk_execute_rq(req->q, NULL, req, 1);
	ret = blk_execute_rq(req->q, NULL, req, 1);
	if (ret == -EIO) {
	if (ret == -EIO) {
		if (req->sense_len > 0) {
		if (req->sense_len > 0) {
@@ -136,8 +136,10 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
		h->path_state = HP_SW_PATH_ACTIVE;
		h->path_state = HP_SW_PATH_ACTIVE;
		ret = SCSI_DH_OK;
		ret = SCSI_DH_OK;
	}
	}
	if (ret == SCSI_DH_IMM_RETRY)
	if (ret == SCSI_DH_IMM_RETRY) {
		blk_put_request(req);
		goto retry;
		goto retry;
	}
	if (ret == SCSI_DH_DEV_OFFLINED) {
	if (ret == SCSI_DH_DEV_OFFLINED) {
		h->path_state = HP_SW_PATH_PASSIVE;
		h->path_state = HP_SW_PATH_PASSIVE;
		ret = SCSI_DH_OK;
		ret = SCSI_DH_OK;
@@ -200,6 +202,7 @@ static int hp_sw_start_stop(struct scsi_device *sdev, struct hp_sw_dh_data *h)
	struct request *req;
	struct request *req;
	int ret, retry;
	int ret, retry;


retry:
	req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO);
	req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO);
	if (!req)
	if (!req)
		return SCSI_DH_RES_TEMP_UNAVAIL;
		return SCSI_DH_RES_TEMP_UNAVAIL;
@@ -216,7 +219,6 @@ static int hp_sw_start_stop(struct scsi_device *sdev, struct hp_sw_dh_data *h)
	req->sense_len = 0;
	req->sense_len = 0;
	retry = h->retries;
	retry = h->retries;


retry:
	ret = blk_execute_rq(req->q, NULL, req, 1);
	ret = blk_execute_rq(req->q, NULL, req, 1);
	if (ret == -EIO) {
	if (ret == -EIO) {
		if (req->sense_len > 0) {
		if (req->sense_len > 0) {
@@ -231,8 +233,10 @@ static int hp_sw_start_stop(struct scsi_device *sdev, struct hp_sw_dh_data *h)
		ret = SCSI_DH_OK;
		ret = SCSI_DH_OK;


	if (ret == SCSI_DH_RETRY) {
	if (ret == SCSI_DH_RETRY) {
		if (--retry)
		if (--retry) {
			blk_put_request(req);
			goto retry;
			goto retry;
		}
		ret = SCSI_DH_IO;
		ret = SCSI_DH_IO;
	}
	}