[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Cleanup backend block device logic under save/restore; this should
# HG changeset patch # User smh22@xxxxxxxxxxxxxxxxxxxx # Node ID 37b93f40eb0a5c2bccff54d9b6b8357ee6b00864 # Parent 450c562b76aab05d8330a2337628b68766e58e6c Cleanup backend block device logic under save/restore; this should fix the issues some people have seen with segfaults in vbd_translate and/or user-space hangs. Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx> diff -r 450c562b76aa -r 37b93f40eb0a linux-2.6-xen-sparse/drivers/xen/blkback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Nov 29 13:37:24 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Nov 29 13:50:30 2005 @@ -38,6 +38,8 @@ struct block_device *bdev; }; +struct backend_info; + typedef struct blkif_st { /* Unique identifier for this interface. */ domid_t domid; @@ -48,8 +50,10 @@ /* Comms information. */ blkif_back_ring_t blk_ring; struct vm_struct *blk_ring_area; - /* VBDs attached to this interface. */ + /* The VBD attached to this interface. */ struct vbd vbd; + /* Back pointer to the backend_info. */ + struct backend_info *be; /* Private fields. */ enum { DISCONNECTED, CONNECTED } status; #ifdef CONFIG_XEN_BLKDEV_TAP_BE @@ -103,6 +107,8 @@ irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs); +void update_blkif_status(blkif_t *blkif); + #endif /* __BLKIF__BACKEND__COMMON_H__ */ /* diff -r 450c562b76aa -r 37b93f40eb0a linux-2.6-xen-sparse/drivers/xen/blkback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Tue Nov 29 13:37:24 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Tue Nov 29 13:50:30 2005 @@ -112,7 +112,9 @@ blkif->irq = bind_evtchn_to_irqhandler( blkif->evtchn, blkif_be_int, 0, "blkif-backend", blkif); - blkif->status = CONNECTED; + + /* We're potentially connected now */ + update_blkif_status(blkif); return 0; } diff -r 450c562b76aa -r 37b93f40eb0a linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Nov 29 13:37:24 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Nov 29 13:50:30 2005 @@ -50,6 +50,16 @@ unsigned int); +void update_blkif_status(blkif_t *blkif) +{ + if(blkif->irq && blkif->vbd.bdev) { + blkif->status = CONNECTED; + (void)blkif_be_int(0, blkif, NULL); + } + maybe_connect(blkif->be); +} + + static ssize_t show_physical_device(struct device *_dev, char *buf) { struct xenbus_device *dev = to_xenbus_device(_dev); @@ -81,6 +91,7 @@ be->backend_watch.node = NULL; } if (be->blkif) { + be->blkif->status = DISCONNECTED; blkif_put(be->blkif); be->blkif = NULL; } @@ -122,6 +133,9 @@ xenbus_dev_fatal(dev, err, "creating block interface"); goto fail; } + + /* setup back pointer */ + be->blkif->be = be; err = xenbus_watch_path2(dev, dev->nodename, "physical-device", &be->backend_watch, backend_changed); @@ -209,7 +223,8 @@ device_create_file(&dev->dev, &dev_attr_physical_device); device_create_file(&dev->dev, &dev_attr_mode); - maybe_connect(be); + /* We're potentially connected now */ + update_blkif_status(be->blkif); } } @@ -235,7 +250,7 @@ if (err) { return; } - maybe_connect(be); + update_blkif_status(be->blkif); break; case XenbusStateClosing: _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |