ia64/xen-unstable

changeset 8170:f62f9b1732b9

Fix VBD recovery logic on SMP guests (+ a minor error reporting fix for save)

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Thu Dec 01 20:43:04 2005 +0100 (2005-12-01)
parents ca236a81729d
children 43582de050c6
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c tools/libxc/xc_linux_save.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Dec 01 20:23:07 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Dec 01 20:43:04 2005 +0100
     1.3 @@ -300,6 +300,10 @@ static void backend_changed(struct xenbu
     1.4  /* ** Connection ** */
     1.5  
     1.6  
     1.7 +/* 
     1.8 +** Invoked when the backend is finally 'ready' (and has told produced 
     1.9 +** the details about the physical device - #sectors, size, etc). 
    1.10 +*/
    1.11  static void connect(struct blkfront_info *info)
    1.12  {
    1.13  	unsigned long sectors, sector_size;
    1.14 @@ -324,20 +328,17 @@ static void connect(struct blkfront_info
    1.15  		return;
    1.16  	}
    1.17  	
    1.18 -        info->connected = BLKIF_STATE_CONNECTED;
    1.19          xlvbd_add(sectors, info->vdevice, binfo, sector_size, info);
    1.20 -	
    1.21 -	err = xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
    1.22 -	if (err)
    1.23 -		return;
    1.24 +
    1.25 +	(void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected); 
    1.26  	
    1.27  	/* Kick pending requests. */
    1.28  	spin_lock_irq(&blkif_io_lock);
    1.29 +	info->connected = BLKIF_STATE_CONNECTED;
    1.30  	kick_pending_request_queues(info);
    1.31  	spin_unlock_irq(&blkif_io_lock);
    1.32  }
    1.33  
    1.34 -
    1.35  /**
    1.36   * Handle the change of state of the backend to Closing.  We must delete our
    1.37   * device-layer structures now, to ensure that writes are flushed through to
    1.38 @@ -770,11 +771,20 @@ static void blkif_recover(struct blkfron
    1.39  
    1.40  	kfree(copy);
    1.41  
    1.42 -	/* Kicks things back into life. */
    1.43 +	(void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected); 
    1.44 +	
    1.45 +	/* Now safe for us to use the shared ring */
    1.46 +	spin_lock_irq(&blkif_io_lock);
    1.47 +        info->connected = BLKIF_STATE_CONNECTED;
    1.48 +	spin_unlock_irq(&blkif_io_lock);
    1.49 +
    1.50 +	/* Send off requeued requests */
    1.51  	flush_requests(info);
    1.52  
    1.53 -	/* Now safe to let other people use the interface. */
    1.54 -	info->connected = BLKIF_STATE_CONNECTED;
    1.55 +	/* Kick any other new requests queued since we resumed */
    1.56 +	spin_lock_irq(&blkif_io_lock);
    1.57 +	kick_pending_request_queues(info);
    1.58 +	spin_unlock_irq(&blkif_io_lock);
    1.59  }
    1.60  
    1.61  
     2.1 --- a/tools/libxc/xc_linux_save.c	Thu Dec 01 20:23:07 2005 +0100
     2.2 +++ b/tools/libxc/xc_linux_save.c	Thu Dec 01 20:43:04 2005 +0100
     2.3 @@ -677,7 +677,7 @@ int xc_linux_save(int xc_handle, int io_
     2.4                               live_shinfo->arch.pfn_to_mfn_frame_list_list);
     2.5  
     2.6      if (!live_p2m_frame_list_list) {
     2.7 -        ERR("Couldn't map p2m_frame_list_list");
     2.8 +        ERR("Couldn't map p2m_frame_list_list (errno %d)", errno);
     2.9          goto out;
    2.10      }
    2.11