Module Name: src Committed By: bouyer Date: Sun Aug 7 17:39:34 UTC 2011
Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: Guard against spurious xbdback_backend_changed() calls which would result in the block device being opened twice. Fixes port-xen/45158, although the underlying cause (multiple open of the same device not properly handled any more) is not fixed. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.44 src/sys/arch/xen/xen/xbdback_xenbus.c:1.45 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.44 Sun Aug 7 17:15:40 2011 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sun Aug 7 17:39:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.44 2011/08/07 17:15:40 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.45 2011/08/07 17:39:34 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.44 2011/08/07 17:15:40 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.45 2011/08/07 17:39:34 bouyer Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -691,10 +691,16 @@ */ if (err) return; - if (xbdi->xbdi_status == CONNECTED && xbdi->xbdi_dev != dev) { - printf("xbdback %s: changing physical device from 0x%"PRIx64 - " to 0x%lx not supported\n", - xbusd->xbusd_path, xbdi->xbdi_dev, dev); + /* + * we can also fire up after having openned the device, don't try + * to do it twice. + */ + if (xbdi->xbdi_vp != NULL) { + if (xbdi->xbdi_status == CONNECTED && xbdi->xbdi_dev != dev) { + printf("xbdback %s: changing physical device from " + "0x%" PRIx64 " to 0x%lx not supported\n", + xbusd->xbusd_path, xbdi->xbdi_dev, dev); + } return; } xbdi->xbdi_dev = dev;