aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-30 23:33:13 -0400
committerNeilBrown <neilb@suse.de>2009-03-30 23:33:13 -0400
commit575a80fa4f623141e9791e41879d87800fb6d862 (patch)
treef316efc3ee33b2914d8b9f3a3041394560ee9e90 /drivers/md/md.c
parent97e4f42d62badb0f9fbc27c013e89bc1336a03bc (diff)
md: be more consistent about setting WriteMostly flag when adding a drive to an array
When a drive is added to an array using ADD_NEW_DISK, there are two places we can get certain flags from: the metadata on the disk or the flags passed through the IOCTL. For the WriteMostly flag (aka MD_DISK_WRITEMOSTLY) we take the value from either of those sources depending on if it is set (i.e. we effectively 'or' the two sources together). This makes it awkward to clear, and is at best inconsistent. As documented code (in mdadm) requires that setting MD_DISK_WRITEMOSTLY in the ioctl will be effective, we resolve the inconsistency by always using the value for this flag from the ioctl, and ignoring the value on disk. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8ea208847a6d..b2c00ce602b1 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4517,6 +4517,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
4517 clear_bit(In_sync, &rdev->flags); /* just to be sure */ 4517 clear_bit(In_sync, &rdev->flags); /* just to be sure */
4518 if (info->state & (1<<MD_DISK_WRITEMOSTLY)) 4518 if (info->state & (1<<MD_DISK_WRITEMOSTLY))
4519 set_bit(WriteMostly, &rdev->flags); 4519 set_bit(WriteMostly, &rdev->flags);
4520 else
4521 clear_bit(WriteMostly, &rdev->flags);
4520 4522
4521 rdev->raid_disk = -1; 4523 rdev->raid_disk = -1;
4522 err = bind_rdev_to_array(rdev, mddev); 4524 err = bind_rdev_to_array(rdev, mddev);