WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug.

To: Keir Fraser <keir.fraser@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug.
From: "Joe Jin" <joe.jin@xxxxxxxxxx>
Date: Tue, 19 Jan 2010 17:52:50 +0800
Cc: joe.jin@xxxxxxxxxx, greg.marsden@xxxxxxxxxx, deepak.patel@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 19 Jan 2010 01:53:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.2i
Hi,

At backend driver blkback and blktap, when checking statistics information,
at the time vbd device remove, kernel will crash.

Below patch will fix it, please review and apply.

Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>

 blkback/xenbus.c |    5 ++++-
 blktap/xenbus.c  |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---

diff -r 6061d5615522 drivers/xen/blkback/xenbus.c
--- a/drivers/xen/blkback/xenbus.c      Fri Jan 08 13:07:17 2010 +0000
+++ b/drivers/xen/blkback/xenbus.c      Tue Jan 19 17:37:32 2010 +0800
@@ -104,10 +104,13 @@
                                   struct device_attribute *attr,       \
                                   char *buf)                           \
        {                                                               \
+               ssize_t ret = -ENODEV;                                  \
                struct xenbus_device *dev = to_xenbus_device(_dev);     \
                struct backend_info *be = dev->dev.driver_data;         \
                                                                        \
-               return sprintf(buf, format, ##args);                    \
+               if (be && be->blkif)                                    \
+                       ret = sprintf(buf, format, ##args);             \
+               return ret;                                             \
        }                                                               \
        static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
 
diff -r 6061d5615522 drivers/xen/blktap/xenbus.c
--- a/drivers/xen/blktap/xenbus.c       Fri Jan 08 13:07:17 2010 +0000
+++ b/drivers/xen/blktap/xenbus.c       Tue Jan 19 17:37:32 2010 +0800
@@ -122,10 +122,13 @@
                                   struct device_attribute *attr,       \
                                   char *buf)                           \
        {                                                               \
+               ssize_t ret = -ENODEV;                                  \
                struct xenbus_device *dev = to_xenbus_device(_dev);     \
                struct backend_info *be = dev->dev.driver_data;         \
                                                                        \
-               return sprintf(buf, format, ##args);                    \
+               if (be && be->blkif)                                    \
+                       ret = sprintf(buf, format, ##args);             \
+               return ret;                                             \
        }                                                               \
        static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel