is created before we are fully connected to the front end, so before
entering the main loop we must make sure that the shared ring is
mapped, otherwise we can fault.
This patch is an essential companion to the other two blkback
patches I committed earlier today. Hopefully this ends the saga.
Signed-off-by: Keir Fraser <keir@xensource.com>
if (debug_lvl)
printk(KERN_DEBUG "%s: started\n", current->comm);
+ /*
+ * This thread may start before we are connected to the frontend
+ * driver. In that case we must wait to be fully connected.
+ */
+ wait_event_interruptible(
+ blkif->wq,
+ blkif_connected(blkif) || kthread_should_stop());
+
while (!kthread_should_stop()) {
wait_event_interruptible(
blkif->wq,
void update_blkif_status(blkif_t *blkif);
+int blkif_connected(blkif_t *blkif);
+
#endif /* __BLKIF__BACKEND__COMMON_H__ */
/*
static void backend_changed(struct xenbus_watch *, const char **,
unsigned int);
+int blkif_connected(blkif_t *blkif)
+{
+ return (blkif->be->dev->state == XenbusStateConnected);
+}
void update_blkif_status(blkif_t *blkif)
{