summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-09-24 13:14:13 +1000
committerNeil Brown <neilb@suse.de>2007-09-24 13:14:13 +1000
commit4d20d744cbf74a4e7d5c42688105683157074f7c (patch)
tree838b5cd4292cf4823d43f54bb0c71727c609f5f9
parent3dacb8902913a4c025b5beb3fb334f9d8b6dc0ce (diff)
downloadmdadm-4d20d744cbf74a4e7d5c42688105683157074f7c.tar.gz
mdadm-4d20d744cbf74a4e7d5c42688105683157074f7c.tar.xz
mdadm-4d20d744cbf74a4e7d5c42688105683157074f7c.zip
Make "--write-mostly" effective when re-adding a device to an array.
Fixes Debian Bug 442874 When we discover that we can 're-add' a drive, we forget to check the write-mostly flag. This highlights the fact that you cannot turn 'off' the write-mostly flag at this point. I wonder if that is a problem...
-rw-r--r--Manage.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Manage.c b/Manage.c
index d857c99..7a96d45 100644
--- a/Manage.c
+++ b/Manage.c
@@ -384,9 +384,9 @@ int Manage_subdevs(char *devname, int fd,
else if (osuper) {
st->ss->uuid_from_super(ouuid, osuper);
if (memcmp(duuid, ouuid, sizeof(ouuid))==0) {
- /* look close enough for now. Kernel
- * will worry about where a bitmap
- * based reconstruct is possible
+ /* looks close enough for now. Kernel
+ * will worry about whether a bitmap
+ * based reconstruction is possible.
*/
struct mdinfo mdi;
st->ss->getinfo_super(&mdi, osuper);
@@ -395,6 +395,8 @@ int Manage_subdevs(char *devname, int fd,
disc.number = mdi.disk.number;
disc.raid_disk = mdi.disk.raid_disk;
disc.state = mdi.disk.state;
+ if (dv->writemostly)
+ disc.state |= 1 << MD_DISK_WRITEMOSTLY;
if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) {
if (verbose >= 0)
fprintf(stderr, Name ": re-added %s\n", dv->devname);