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

xen-devel

[Top] [All Lists]

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

To: "Joe Jin" <joe.jin@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug.
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: 2010年1月20日 07:46:19 +0000
Cc: Keir Fraser <keir.fraser@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, deepak.patel@xxxxxxxxxx, greg.marsden@xxxxxxxxxx
Delivery-date: 2010年1月19日 23:46:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100120020605.GA25697@xxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <20100119095250.GB20691@xxxxxxxxxxxxxxxxxxxxxxx> <4B5596B2020000780002AAF1@xxxxxxxxxxxxxxxxxx> <20100119113224.GA21348@xxxxxxxxxxxxxxxxxxxxxxx> <4B55AE58020000780002AB39@xxxxxxxxxxxxxxxxxx> <20100119141338.GA22249@xxxxxxxxxxxxxxxxxxxxxxx> <4B55E9E7020000780002AC17@xxxxxxxxxxxxxxxxxx> <20100120020605.GA25697@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> "Joe Jin" <joe.jin@xxxxxxxxxx> 20.01.10 03:06 >>>
>sysfs did not provide lock to handle this, not sure if developer
>think it is not necessary or they'd like to caller to handled it.
A lock is probably not the usual way to deal with this; ref-counting
would seem more common. Nevertheless I think adding a lock will
take care of the issue here.
>--- a/drivers/xen/blktap/xenbus.c Fri Jan 08 13:07:17 2010 +0000
>+++ b/drivers/xen/blktap/xenbus.c Wed Jan 20 10:00:53 2010 +0800
>...
>@@ -122,10 +123,15 @@
> struct device_attribute *attr, \
> char *buf) \
> { \
>+ ssize_t ret = -ENODEV; \
> struct xenbus_device *dev = to_xenbus_device(_dev); \
The use of to_xenbus_device() here makes ...
>- struct backend_info *be = dev->dev.driver_data; \
>+ struct backend_info *be; \
> \
>- return sprintf(buf, format, ##args); \
>+ read_lock(&sysfs_read_lock); \
>+ if (dev && (be = dev->dev.driver_data) && be->blkif) \
... the checking of dev here useless (and the blkback part of the patch
doesn't do the same).
>+ ret = sprintf(buf, format, ##args); \
>+ read_unlock(&sysfs_read_lock); \
>+ return ret; \
> } \
> static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
>
And btw., in both cases with the lock added there's no need to check
both 'be' and 'be->blkif', since be->blkif can't be NULL when be is
non-NULL.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: [Xen-devel] trouble with the new mmap-batch interface , Brendan Cully
Next by Date: Re: [Xen-devel][PATCH] Change vcpu_avail type to hex string when passing to xc.hvm_build() , Keir Fraser
Previous by Thread: Re: [Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug. , Joe Jin
Next by Thread: Re: [Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug. , Joe Jin
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /