xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix blkback/blktap sysfs read bug.
@ 2010-01-19  9:52 Joe Jin
  2010-01-19 10:25 ` Jan Beulich
  0 siblings, 1 reply; 17+ messages in thread
From: Joe Jin @ 2010-01-19  9:52 UTC (permalink / raw)
  To: Keir Fraser; +Cc: joe.jin, greg.marsden, deepak.patel, xen-devel

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@oracle.com>

 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)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-01-21 18:01 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19  9:52 [PATCH] Fix blkback/blktap sysfs read bug Joe Jin
2010-01-19 10:25 ` Jan Beulich
2010-01-19 11:32   ` Joe Jin
2010-01-19 12:06     ` Jan Beulich
2010-01-19 14:13       ` Joe Jin
2010-01-19 16:20         ` Jan Beulich
2010-01-20  2:06           ` Joe Jin
2010-01-20  7:46             ` Jan Beulich
2010-01-20 10:51               ` Joe Jin
2010-01-20 11:06                 ` Jan Beulich
2010-01-20 11:45                   ` Joe Jin
2010-01-20 20:25                     ` Keir Fraser
2010-01-21  2:16                     ` Daniel Stodden
2010-01-21  3:13                       ` Joe Jin
2010-01-21  7:26                         ` Daniel Stodden
2010-01-21  7:49                           ` Joe Jin
2010-01-21 18:01                             ` Daniel Stodden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).