ia64/xen-unstable

changeset 10391:91d2f2258c56

[LINUX] Fix blkfront driver to check connection status to backend in
all critical circumstances.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Tue Jun 13 15:13:29 2006 +0100 (2006-06-13)
parents 1650e07c9e52
children 3d85c1136d63
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Jun 13 14:36:04 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Jun 13 15:13:29 2006 +0100
     1.3 @@ -407,7 +407,8 @@ static void blkif_restart_queue(void *ar
     1.4  {
     1.5  	struct blkfront_info *info = (struct blkfront_info *)arg;
     1.6  	spin_lock_irq(&blkif_io_lock);
     1.7 -	kick_pending_request_queues(info);
     1.8 +	if (info->connected == BLKIF_STATE_CONNECTED)
     1.9 +		kick_pending_request_queues(info);
    1.10  	spin_unlock_irq(&blkif_io_lock);
    1.11  }
    1.12  
    1.13 @@ -595,7 +596,8 @@ void do_blkif_request(request_queue_t *r
    1.14  			continue;
    1.15  		}
    1.16  
    1.17 -		if (RING_FULL(&info->ring))
    1.18 +		if (unlikely(info->connected != BLKIF_STATE_CONNECTED) ||
    1.19 +		    RING_FULL(&info->ring))
    1.20  			goto wait;
    1.21  
    1.22  		DPRINTK("do_blk_req %p: cmd %p, sec %lx, "
    1.23 @@ -768,17 +770,17 @@ static void blkif_recover(struct blkfron
    1.24  
    1.25  	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
    1.26  
    1.27 +	spin_lock_irq(&blkif_io_lock);
    1.28 +
    1.29  	/* Now safe for us to use the shared ring */
    1.30 -	spin_lock_irq(&blkif_io_lock);
    1.31  	info->connected = BLKIF_STATE_CONNECTED;
    1.32 -	spin_unlock_irq(&blkif_io_lock);
    1.33  
    1.34  	/* Send off requeued requests */
    1.35  	flush_requests(info);
    1.36  
    1.37  	/* Kick any other new requests queued since we resumed */
    1.38 -	spin_lock_irq(&blkif_io_lock);
    1.39  	kick_pending_request_queues(info);
    1.40 +
    1.41  	spin_unlock_irq(&blkif_io_lock);
    1.42  }
    1.43