]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.fixes/0026-md-remove-rd-d-links-immediately-after-stopping-an-a.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / 0026-md-remove-rd-d-links-immediately-after-stopping-an-a.patch
1 From c4647292fda0833bebe45be27f04453b736981fa Mon Sep 17 00:00:00 2001
2 From: NeilBrown <neilb@suse.de>
3 Date: Thu, 7 May 2009 12:51:06 +1000
4 Subject: [PATCH] md: remove rd%d links immediately after stopping an array.
5
6 md maintains link in sys/mdXX/md/ to identify which device has
7 which role in the array. e.g.
8 rd2 -> dev-sda
9
10 indicates that the device with role '2' in the array is sda.
11
12 These links are only present when the array is active. They are
13 created immediately after ->run is called, and so should be removed
14 immediately after ->stop is called.
15 However they are currently removed a little bit later, and it is
16 possible for ->run to be called again, thus adding these links, before
17 they are removed.
18
19 So move the removal earlier so they are consistently only present when
20 the array is active.
21
22 Signed-off-by: NeilBrown <neilb@suse.de>
23 ---
24 drivers/md/md.c | 17 ++++++++---------
25 1 file changed, 8 insertions(+), 9 deletions(-)
26
27 --- a/drivers/md/md.c
28 +++ b/drivers/md/md.c
29 @@ -3877,6 +3877,7 @@ static int do_md_stop(mddev_t * mddev, i
30 {
31 int err = 0;
32 struct gendisk *disk = mddev->gendisk;
33 + mdk_rdev_t *rdev;
34
35 if (atomic_read(&mddev->openers) > is_open) {
36 printk("md: %s still in use.\n",mdname(mddev));
37 @@ -3919,6 +3920,13 @@ static int do_md_stop(mddev_t * mddev, i
38 /* tell userspace to handle 'inactive' */
39 sysfs_notify(&mddev->kobj, NULL, "array_state");
40
41 + list_for_each_entry(rdev, &mddev->disks, same_set)
42 + if (rdev->raid_disk >= 0) {
43 + char nm[20];
44 + sprintf(nm, "rd%d", rdev->raid_disk);
45 + sysfs_remove_link(&mddev->kobj, nm);
46 + }
47 +
48 set_capacity(disk, 0);
49 mddev->changed = 1;
50
51 @@ -3939,8 +3947,6 @@ static int do_md_stop(mddev_t * mddev, i
52 * Free resources if final stop
53 */
54 if (mode == 0) {
55 - mdk_rdev_t *rdev;
56 - struct list_head *tmp;
57
58 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
59
60 @@ -3952,13 +3958,6 @@ static int do_md_stop(mddev_t * mddev, i
61 }
62 mddev->bitmap_offset = 0;
63
64 - rdev_for_each(rdev, tmp, mddev)
65 - if (rdev->raid_disk >= 0) {
66 - char nm[20];
67 - sprintf(nm, "rd%d", rdev->raid_disk);
68 - sysfs_remove_link(&mddev->kobj, nm);
69 - }
70 -
71 /* make sure all md_delayed_delete calls have finished */
72 flush_scheduled_work();
73