ia64/linux-2.6.18-xen.hg

changeset 601:e0c15322ff6d

pvSCSI: More fixes (including locking cleanups)

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jul 14 10:15:44 2008 +0100 (2008-07-14)
parents 1bd3dbfdaf0f
children a682229d0eac
files drivers/xen/scsifront/common.h drivers/xen/scsifront/scsifront.c drivers/xen/scsifront/xenbus.c
line diff
     1.1 --- a/drivers/xen/scsifront/common.h	Fri Jul 11 15:34:33 2008 +0100
     1.2 +++ b/drivers/xen/scsifront/common.h	Mon Jul 14 10:15:44 2008 +0100
     1.3 @@ -112,9 +112,6 @@ struct vscsifrnt_info {
     1.4  	struct task_struct *kthread;
     1.5  	wait_queue_head_t wq;
     1.6  	unsigned int waiting_resp;
     1.7 -	
     1.8 -	/* abort reset condition bit*/
     1.9 -	atomic_t abort_reset_cond;
    1.10  
    1.11  };
    1.12  
     2.1 --- a/drivers/xen/scsifront/scsifront.c	Fri Jul 11 15:34:33 2008 +0100
     2.2 +++ b/drivers/xen/scsifront/scsifront.c	Mon Jul 14 10:15:44 2008 +0100
     2.3 @@ -146,12 +146,7 @@ static void scsifront_cdb_cmd_done(struc
     2.4  	scsifront_gnttab_done(&info->shadow[id], id);
     2.5  	add_id_to_freelist(info, id);
     2.6  
     2.7 -	if (atomic_read(&info->abort_reset_cond) == VSCSI_IN_RESET) {
     2.8 -		sc->result = (DID_RESET << 16);
     2.9 -	} else {
    2.10 -		sc->result = ring_res->rslt;
    2.11 -	}
    2.12 -
    2.13 +	sc->result = ring_res->rslt;
    2.14  	sc->resid  = 0;
    2.15  
    2.16  	if (ring_res->sense_len > VSCSIIF_SENSE_BUFFERSIZE)
    2.17 @@ -432,22 +427,18 @@ static int scsifront_dev_reset_handler(s
    2.18  		(struct vscsifrnt_info *) sc->device->host->hostdata;
    2.19  
    2.20  	vscsiif_request_t *ring_req;
    2.21 +	uint16_t rqid;
    2.22  	int err;
    2.23  
    2.24  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
    2.25  	spin_lock_irq(host->host_lock);
    2.26  #endif
    2.27  
    2.28 -	atomic_set(&info->abort_reset_cond, VSCSI_IN_RESET);
    2.29 -	while (RING_HAS_UNCONSUMED_RESPONSES(&info->ring)) {
    2.30 -		if (!scsifront_cmd_done(info))
    2.31 -			break;
    2.32 -	}
    2.33 -
    2.34  	ring_req      = scsifront_pre_request(info);
    2.35  	ring_req->act = VSCSIIF_ACT_SCSI_RESET;
    2.36  
    2.37 -	info->shadow[ring_req->rqid].act = VSCSIIF_ACT_SCSI_RESET;
    2.38 +	rqid          = ring_req->rqid;
    2.39 +	info->shadow[rqid].act = VSCSIIF_ACT_SCSI_RESET;
    2.40  
    2.41  	ring_req->channel = sc->device->channel;
    2.42  	ring_req->id      = sc->device->id;
    2.43 @@ -463,20 +454,20 @@ static int scsifront_dev_reset_handler(s
    2.44  	ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
    2.45  	ring_req->nr_segments         = 0;
    2.46  
    2.47 -	spin_unlock_irq(host->host_lock);
    2.48  	scsifront_do_request(info);	
    2.49 -	wait_event_interruptible(info->shadow[ring_req->rqid].wq_reset,
    2.50 -			 info->shadow[ring_req->rqid].wait_reset);
    2.51  
    2.52 +	spin_unlock_irq(host->host_lock);
    2.53 +	wait_event_interruptible(info->shadow[rqid].wq_reset,
    2.54 +			 info->shadow[rqid].wait_reset);
    2.55  	spin_lock_irq(host->host_lock);
    2.56  
    2.57 -	err = info->shadow[ring_req->rqid].rslt_reset;
    2.58 -	atomic_set(&info->abort_reset_cond, 0);
    2.59 +	err = info->shadow[rqid].rslt_reset;
    2.60 +
    2.61 +	add_id_to_freelist(info, rqid);
    2.62  
    2.63  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
    2.64  	spin_unlock_irq(host->host_lock);
    2.65  #endif
    2.66 -
    2.67  	return (err);
    2.68  }
    2.69  
     3.1 --- a/drivers/xen/scsifront/xenbus.c	Fri Jul 11 15:34:33 2008 +0100
     3.2 +++ b/drivers/xen/scsifront/xenbus.c	Mon Jul 14 10:15:44 2008 +0100
     3.3 @@ -195,8 +195,6 @@ static int scsifront_probe(struct xenbus
     3.4  	}
     3.5  	info->shadow[VSCSIIF_MAX_REQS - 1].next_free = 0x0fff;
     3.6  
     3.7 -	atomic_set(&info->abort_reset_cond, 0);
     3.8 -
     3.9  	err = scsifront_init_ring(info);
    3.10  	if (err) {
    3.11  		scsi_host_put(host);