Index: xen-3.2-testing/tools/ioemu/xenstore.c =================================================================== --- xen-3.2-testing.orig/tools/ioemu/xenstore.c 2008-01-31 07:52:20.000000000 -0700 +++ xen-3.2-testing/tools/ioemu/xenstore.c 2008-01-31 07:56:00.000000000 -0700 @@ -478,7 +478,7 @@ void xenstore_process_event(void *opaque) { - char **vec, *image = NULL; + char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL; unsigned int len, num, hd_index; vec = xs_read_watch(xsh, &num); @@ -505,8 +505,23 @@ goto out; hd_index = vec[XS_WATCH_TOKEN][2] - 'a'; image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len); - if (image == NULL || !strcmp(image, bs_table[hd_index]->filename)) - goto out; /* gone or identical */ + if (image == NULL) + goto out; /* gone */ + + /* Strip off blktap sub-type prefix */ + bpath = strdup(vec[XS_WATCH_PATH]); + if (bpath == NULL) + goto out; + if ((offset = strrchr(bpath, '/')) != NULL) + *offset = '\0'; + if (pasprintf(&buf, "%s/type", bpath) == -1) + goto out; + drv = xs_read(xsh, XBT_NULL, buf, &len); + if (drv && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != NULL)) + memmove(image, offset+1, strlen(offset+1)+1); + + if (!strcmp(image, bs_table[hd_index]->filename)) + goto out; /* identical */ do_eject(0, vec[XS_WATCH_TOKEN]); bs_table[hd_index]->filename[0] = 0; @@ -521,6 +536,9 @@ } out: + free(drv); + free(buf); + free(bpath); free(image); free(vec); }