Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Fix problem with using wedge like devicesi(...



details:   https://anonhg.NetBSD.org/src/rev/fba9811bdbb4
branches:  trunk
changeset: 750056:fba9811bdbb4
user:      haad <haad%NetBSD.org@localhost>
date:      Tue Dec 15 00:19:52 2009 +0000

description:
Fix problem with using wedge like devicesi(LVM Logical Volumes, ZFS Zvols)
as xkbd backend. This problem was reported by Hugo Silva on port-xen.

Now we call DIOCGWEDGEINFO for all partitions, when it is not implemented
we use DIOCGPART to get information about volume size.

Fix oked by jym@.

diffstat:

 sys/arch/xen/xen/xbdback_xenbus.c |  34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diffs (59 lines):

diff -r 59185c145eb1 -r fba9811bdbb4 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Mon Dec 14 23:36:52 2009 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Tue Dec 15 00:19:52 2009 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.28 2009/10/25 13:47:43 bouyer Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.29 2009/12/15 00:19:52 haad Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.28 2009/10/25 13:47:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.29 2009/12/15 00:19:52 haad Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -721,24 +721,26 @@
                return;
        }
        VOP_UNLOCK(xbdi->xbdi_vp, 0);
-       if (strcmp(devname, "dk") == 0) {
-               /* dk device; get wedge data */
-               struct dkwedge_info wi;
-               err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGWEDGEINFO, &wi,
-                   FREAD, NOCRED);
-               if (err) {
-                       printf("xbdback %s: can't DIOCGWEDGEINFO device "
-                           "0x%"PRIx64": %d\n", xbusd->xbusd_path,
-                           xbdi->xbdi_dev, err);
-                       xbdi->xbdi_size = xbdi->xbdi_dev = 0;
-                       vn_close(xbdi->xbdi_vp, FREAD, NOCRED);
-                       xbdi->xbdi_vp = NULL;
-                       return;
-               }
+
+       /* dk device; get wedge data */
+       struct dkwedge_info wi;
+       if ((err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGWEDGEINFO, &wi,
+                   FREAD, NOCRED)) == 0) {
                xbdi->xbdi_size = wi.dkw_size;
                printf("xbd backend: attach device %s (size %" PRIu64 ") "
                    "for domain %d\n", wi.dkw_devname, xbdi->xbdi_size,
                    xbdi->xbdi_domid);
+       }
+       /* ENOTTY should be returned only when device doesn't implement
+          DIOCGWEDGEINFO and we are working with non wedge like device. */
+       if (err != ENOTTY) {
+               printf("xbdback %s: can't DIOCGWEDGEINFO device "
+                   "0x%"PRIx64": %d\n", xbusd->xbusd_path,
+                   xbdi->xbdi_dev, err);               
+               xbdi->xbdi_size = xbdi->xbdi_dev = 0;
+               vn_close(xbdi->xbdi_vp, FREAD, NOCRED);
+               xbdi->xbdi_vp = NULL;
+               return;
        } else {
                /* disk device, get partition data */
                struct partinfo dpart;



Home | Main Index | Thread Index | Old Index