]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/0026-md-remove-rd-d-links-immediately-after-stopping-an-a.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / 0026-md-remove-rd-d-links-immediately-after-stopping-an-a.patch
CommitLineData
2cb7cef9
BS
1From c4647292fda0833bebe45be27f04453b736981fa Mon Sep 17 00:00:00 2001
2From: NeilBrown <neilb@suse.de>
3Date: Thu, 7 May 2009 12:51:06 +1000
4Subject: [PATCH] md: remove rd%d links immediately after stopping an array.
5
6md maintains link in sys/mdXX/md/ to identify which device has
7which role in the array. e.g.
8 rd2 -> dev-sda
9
10indicates that the device with role '2' in the array is sda.
11
12These links are only present when the array is active. They are
13created immediately after ->run is called, and so should be removed
14immediately after ->stop is called.
15However they are currently removed a little bit later, and it is
16possible for ->run to be called again, thus adding these links, before
17they are removed.
18
19So move the removal earlier so they are consistently only present when
20the array is active.
21
22Signed-off-by: NeilBrown <neilb@suse.de>
23---
24 drivers/md/md.c | 17 ++++++++---------
25 1 file changed, 8 insertions(+), 9 deletions(-)
26
27--- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/md.c
28+++ linux-2.6.27-SLE11_BRANCH/drivers/md/md.c
29@@ -3960,6 +3960,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@@ -4002,6 +4003,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@@ -4022,8 +4030,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@@ -4035,13 +4041,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