]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.3/xen-fix-is_disconnected_device-exists_disconnected_device.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.3 / xen-fix-is_disconnected_device-exists_disconnected_device.patch
1 From c6e1971139be1342902873181f3b80a979bfb33b Mon Sep 17 00:00:00 2001
2 From: Paolo Bonzini <pbonzini@redhat.com>
3 Date: Wed, 8 Jul 2009 12:27:37 +0200
4 Subject: xen: fix is_disconnected_device/exists_disconnected_device
5
6 From: Paolo Bonzini <pbonzini@redhat.com>
7
8 commit c6e1971139be1342902873181f3b80a979bfb33b upstream.
9
10 The logic of is_disconnected_device/exists_disconnected_device is wrong
11 in that they are used to test whether a device is trying to connect (i.e.
12 connecting). For this reason the patch fixes them to not consider a
13 Closing or Closed device to be connecting. At the same time the patch
14 also renames the functions according to what they really do; you could
15 say a closed device is "disconnected" (the old name), but not "connecting"
16 (the new name).
17
18 This patch is a backport of changeset 909 from the Xenbits tree.
19
20 Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
21 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
22 Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24
25 ---
26 drivers/xen/xenbus/xenbus_probe.c | 13 +++++++------
27 1 file changed, 7 insertions(+), 6 deletions(-)
28
29 --- a/drivers/xen/xenbus/xenbus_probe.c
30 +++ b/drivers/xen/xenbus/xenbus_probe.c
31 @@ -843,7 +843,7 @@ postcore_initcall(xenbus_probe_init);
32
33 MODULE_LICENSE("GPL");
34
35 -static int is_disconnected_device(struct device *dev, void *data)
36 +static int is_device_connecting(struct device *dev, void *data)
37 {
38 struct xenbus_device *xendev = to_xenbus_device(dev);
39 struct device_driver *drv = data;
40 @@ -861,14 +861,15 @@ static int is_disconnected_device(struct
41 return 0;
42
43 xendrv = to_xenbus_driver(dev->driver);
44 - return (xendev->state != XenbusStateConnected ||
45 - (xendrv->is_ready && !xendrv->is_ready(xendev)));
46 + return (xendev->state < XenbusStateConnected ||
47 + (xendev->state == XenbusStateConnected &&
48 + xendrv->is_ready && !xendrv->is_ready(xendev)));
49 }
50
51 -static int exists_disconnected_device(struct device_driver *drv)
52 +static int exists_connecting_device(struct device_driver *drv)
53 {
54 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
55 - is_disconnected_device);
56 + is_device_connecting);
57 }
58
59 static int print_device_status(struct device *dev, void *data)
60 @@ -918,7 +919,7 @@ static void wait_for_devices(struct xenb
61 if (!ready_to_wait_for_devices || !xen_domain())
62 return;
63
64 - while (exists_disconnected_device(drv)) {
65 + while (exists_connecting_device(drv)) {
66 if (time_after(jiffies, timeout))
67 break;
68 schedule_timeout_interruptible(HZ/10);