NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-xen/45158: Xen Kernel panics when restarting DomU (Problem with vnd detach?)



I've sent this patch to tech-kern, but I'm afraid the problem is far
deeper, this only prevents xbdback from trying to attach an already
attached disk, and the crash doesn't happen, but the problem is still
there in the underlying functions called by xbdback (bdevvp, vn_lock
or VOP_OPEN). I'm still trying to figure out which one of this
functions is responsible of the problem. I think the patch should be
added anyway, because it prevents from doing unnecessary syscalls, an
avoids the typical "xbdback backend/vbd/2/51714: can't VOP_OPEN device
0xa906: 16", but it's not a complete solution for this bug.

Regards, Roger.

Index: sys/arch/xen/xen/xbdback_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xbdback_xenbus.c,v
retrieving revision 1.41
diff -u -r1.41 xbdback_xenbus.c
--- sys/arch/xen/xen/xbdback_xenbus.c   24 Jul 2011 23:56:34 -0000      1.41
+++ sys/arch/xen/xen/xbdback_xenbus.c   25 Jul 2011 15:55:28 -0000
@@ -675,6 +675,7 @@
 {
        struct xenbus_device *xbusd = watch->xbw_dev;
        struct xbdback_instance *xbdi = xbusd->xbusd_u.b.b_cookie;
+       struct xbdback_instance *xbdi_iter;
        int err;
        long dev;
        char *mode;
@@ -696,6 +697,12 @@
                    xbusd->xbusd_path, xbdi->xbdi_dev, dev);
                return;
        }
+       SLIST_FOREACH(xbdi_iter, &xbdback_instances, next) {
+               if (xbdi_iter->xbdi_dev == dev) {
+                       printf("xbdback: device 0x%lx already opened\n", dev);
+                       return;
+               }
+       }
        xbdi->xbdi_dev = dev;
        err = xenbus_read(NULL, xbusd->xbusd_path, "mode", NULL, &mode);
        if (err) {


Home | Main Index | Thread Index | Old Index