]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From 575a80fa4f623141e9791e41879d87800fb6d862 Mon Sep 17 00:00:00 2001 |
2 | From: NeilBrown <neilb@suse.de> | |
3 | Date: Tue, 31 Mar 2009 14:33:13 +1100 | |
4 | Subject: [PATCH] md: be more consistent about setting WriteMostly flag when adding a drive to an array | |
5 | ||
6 | When a drive is added to an array using ADD_NEW_DISK, there are two | |
7 | places we can get certain flags from: the metadata on the disk or the | |
8 | flags passed through the IOCTL. | |
9 | ||
10 | For the WriteMostly flag (aka MD_DISK_WRITEMOSTLY) we take the value | |
11 | from either of those sources depending on if it is set (i.e. we | |
12 | effectively 'or' the two sources together). | |
13 | ||
14 | This makes it awkward to clear, and is at best inconsistent. | |
15 | ||
16 | As documented code (in mdadm) requires that setting | |
17 | MD_DISK_WRITEMOSTLY in the ioctl will be effective, we resolve the | |
18 | inconsistency by always using the value for this flag from the ioctl, | |
19 | and ignoring the value on disk. | |
20 | ||
21 | ||
22 | Signed-off-by: NeilBrown <neilb@suse.de> | |
23 | --- | |
24 | drivers/md/md.c | 2 ++ | |
25 | 1 file changed, 2 insertions(+) | |
26 | ||
27 | --- a/drivers/md/md.c | |
28 | +++ b/drivers/md/md.c | |
29 | @@ -4349,6 +4349,8 @@ static int add_new_disk(mddev_t * mddev, | |
30 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ | |
31 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) | |
32 | set_bit(WriteMostly, &rdev->flags); | |
33 | + else | |
34 | + clear_bit(WriteMostly, &rdev->flags); | |
35 | ||
36 | rdev->raid_disk = -1; | |
37 | err = bind_rdev_to_array(rdev, mddev); |