Magellan Linux

Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1009-2.6.25-xen-blkfront-Delay-wait-for-block-devices-until-aft.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 606 - (show annotations) (download)
Thu May 22 23:13:13 2008 UTC (15 years, 11 months ago) by niro
File size: 3670 byte(s)
-ver bump to 2.6.25-magellan-r1:
- linux-2.6.25.4
- fbcondecor-0.9.4
- squashfs-3.3
- unionfs-2.3.3
- tuxonice-3.0-rc7
- linux-phc-0.3.0
- acpi-dstd-0.9a
- reiser4
- xen-3.2.0
. ipw3945-1.2.2

1 From f39c4a4296630435220f4485cfc61b895642d188 Mon Sep 17 00:00:00 2001
2 From: Christian Limpach <Christian.Limpach@xensource.com>
3 Date: Wed, 19 Mar 2008 15:54:48 +0000
4 Subject: [PATCH] xen blkfront: Delay wait for block devices until after the disk is added.
5
6 When the xen block frontend driver is built as a module the module load
7 is only synchronous up to the point where the frontend and the backend
8 become connected rather than when the disk is added.
9
10 This means that there can be a race on boot between loading the module and
11 loading the dm-* modules and doing the scan for LVM physical volumes (all
12 in the initrd). In the failure case the disk is not present until after the
13 scan for physical volumes is complete.
14
15 Taken from:
16
17 http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/11483a00c017
18
19 Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
20 Signed-off-by: Mark McLoughlin <markmc@redhat.com>
21 ---
22 drivers/block/xen-blkfront.c | 11 +++++++++++
23 drivers/xen/xenbus/xenbus_probe.c | 5 ++++-
24 include/xen/xenbus.h | 1 +
25 3 files changed, 16 insertions(+), 1 deletions(-)
26
27 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
28 index 8ce168d..74f943a 100644
29 --- a/drivers/block/xen-blkfront.c
30 +++ b/drivers/block/xen-blkfront.c
31 @@ -89,6 +89,7 @@ struct blkfront_info
32 struct blk_shadow shadow[BLK_RING_SIZE];
33 unsigned long shadow_free;
34 int feature_barrier;
35 + int is_ready;
36
37 /**
38 * The number of people holding this device open. We won't allow a
39 @@ -840,6 +841,8 @@ static void blkfront_connect(struct blkfront_info *info)
40 spin_unlock_irq(&blkif_io_lock);
41
42 add_disk(info->gd);
43 +
44 + info->is_ready = 1;
45 }
46
47 /**
48 @@ -932,6 +935,13 @@ static int blkfront_remove(struct xenbus_device *dev)
49 return 0;
50 }
51
52 +static int blkfront_is_ready(struct xenbus_device *dev)
53 +{
54 + struct blkfront_info *info = dev->dev.driver_data;
55 +
56 + return info->is_ready;
57 +}
58 +
59 static int blkif_open(struct inode *inode, struct file *filep)
60 {
61 struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
62 @@ -978,6 +988,7 @@ static struct xenbus_driver blkfront = {
63 .remove = blkfront_remove,
64 .resume = blkfront_resume,
65 .otherend_changed = backend_changed,
66 + .is_ready = blkfront_is_ready,
67 };
68
69 static int __init xlblk_init(void)
70 diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
71 index 336363c..57ceb53 100644
72 --- a/drivers/xen/xenbus/xenbus_probe.c
73 +++ b/drivers/xen/xenbus/xenbus_probe.c
74 @@ -869,6 +869,7 @@ static int is_disconnected_device(struct device *dev, void *data)
75 {
76 struct xenbus_device *xendev = to_xenbus_device(dev);
77 struct device_driver *drv = data;
78 + struct xenbus_driver *xendrv;
79
80 /*
81 * A device with no driver will never connect. We care only about
82 @@ -881,7 +882,9 @@ static int is_disconnected_device(struct device *dev, void *data)
83 if (drv && (dev->driver != drv))
84 return 0;
85
86 - return (xendev->state != XenbusStateConnected);
87 + xendrv = to_xenbus_driver(dev->driver);
88 + return (xendev->state != XenbusStateConnected ||
89 + (xendrv->is_ready && !xendrv->is_ready(xendev)));
90 }
91
92 static int exists_disconnected_device(struct device_driver *drv)
93 diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
94 index 6f7c290..6369d89 100644
95 --- a/include/xen/xenbus.h
96 +++ b/include/xen/xenbus.h
97 @@ -97,6 +97,7 @@ struct xenbus_driver {
98 int (*uevent)(struct xenbus_device *, char **, int, char *, int);
99 struct device_driver driver;
100 int (*read_otherend_details)(struct xenbus_device *dev);
101 + int (*is_ready)(struct xenbus_device *dev);
102 };
103
104 static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
105 --
106 1.5.4.1
107