Commit 9b833e42 authored by Dave C Boutcher's avatar Dave C Boutcher Committed by James Bottomley

[SCSI] ibmvscsi: prevent scsi commands being sent in invalid state

There is a window where we can be re-enabling an adapter, but
still allow SCSI commands to be sent to the target.  This fix
sets our window (request_limit) to -1 as soon as we know the
adapter is being reenabled, and closes a very teeny tiny
window where we could set the window back to 1 before we
grab a lock.
Signed-off-by: default avatarDave Boutcher <sleddog@us.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 18c49b8c
...@@ -853,14 +853,15 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata) ...@@ -853,14 +853,15 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu); login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu);
login->required_buffer_formats = 0x0006; login->required_buffer_formats = 0x0006;
spin_lock_irqsave(hostdata->host->host_lock, flags);
/* Start out with a request limit of 1, since this is negotiated in /* Start out with a request limit of 1, since this is negotiated in
* the login request we are just sending * the login request we are just sending
*/ */
atomic_set(&hostdata->request_limit, 1); atomic_set(&hostdata->request_limit, 1);
spin_lock_irqsave(hostdata->host->host_lock, flags);
rc = ibmvscsi_send_srp_event(evt_struct, hostdata); rc = ibmvscsi_send_srp_event(evt_struct, hostdata);
spin_unlock_irqrestore(hostdata->host->host_lock, flags); spin_unlock_irqrestore(hostdata->host->host_lock, flags);
printk("ibmvscsic: sent SRP login\n");
return rc; return rc;
}; };
...@@ -1179,6 +1180,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq, ...@@ -1179,6 +1180,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
/* We need to re-setup the interpartition connection */ /* We need to re-setup the interpartition connection */
printk(KERN_INFO printk(KERN_INFO
"ibmvscsi: Re-enabling adapter!\n"); "ibmvscsi: Re-enabling adapter!\n");
atomic_set(&hostdata->request_limit, -1);
purge_requests(hostdata, DID_REQUEUE); purge_requests(hostdata, DID_REQUEUE);
if (ibmvscsi_reenable_crq_queue(&hostdata->queue, if (ibmvscsi_reenable_crq_queue(&hostdata->queue,
hostdata) == 0) hostdata) == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment