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: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: 2010年1月20日 18:16:36 -0800
Cc: "greg.marsden@xxxxxxxxxx" <greg.marsden@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "deepak.patel@xxxxxxxxxx" <deepak.patel@xxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: 2010年1月20日 18:16:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100120114518.GA10851@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> <4B56C2DB020000780002AE45@xxxxxxxxxxxxxxxxxx> <20100120105136.GA6801@xxxxxxxxxxxxxxxxxxxxxxx> <4B56F1B6020000780002AEFA@xxxxxxxxxxxxxxxxxx> <20100120114518.GA10851@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hey.
I think reverted a similar patch when moving past 2.6.18 a while ago,
but I don't remember the first kernel versions affected right now.
On Wed, 2010年01月20日 at 06:45 -0500, Joe Jin wrote:
> static void connect(struct backend_info *);
> static int connect_ring(struct backend_info *);
> @@ -122,10 +123,19 @@
> struct device_attribute *attr, \
> char *buf) \
> { \
> - struct xenbus_device *dev = to_xenbus_device(_dev); \
> - struct backend_info *be = dev->dev.driver_data; \
> + ssize_t ret = -ENODEV; \
> + struct xenbus_device *dev; \
> + struct backend_info *be; \
 \
> - return sprintf(buf, format, ##args); \
> + if (!get_device(_dev)) \
> + return ret; \
> + dev = to_xenbus_device(_dev); \
I think this deadlocks here:
> + read_lock(&sysfs_read_lock); \
> + if ((be = dev->dev.driver_data) != NULL) \
> + ret = sprintf(buf, format, ##args); \
> + read_unlock(&sysfs_read_lock); \
> + put_device(_dev); \
> + return ret; \
> } \
> static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
>
> @@ -170,6 +180,7 @@
> {
> struct backend_info *be = dev->dev.driver_data;
>
> + write_lock(&sysfs_read_lock);
> if (be->group_added)
.. and here:
> xentap_sysfs_delif(be->dev);
> if (be->backend_watch.node) {
> @@ -187,6 +198,7 @@
> }
> kfree(be);
> dev->dev.driver_data = NULL;
> + write_unlock(&sysfs_read_lock);
> return 0;
> }
Sysfs may refcount these nodes, blocking xentap_sysfs_delif().
Daniel
_______________________________________________
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] [PATCH] Fix blk{back,tap} sysfs race , Joe Jin
Next by Date: [Xen-devel] [PATCH] VT-d: handle return value of deassign_device , Han, Weidong
Previous by Thread: Re: [Xen-devel] [PATCH] Fix blkback/blktap sysfs read bug. , Keir Fraser
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 によって変換されたページ (->オリジナル) /