Bug 464743 - can't clear --write-mostly when re-adding former --write-mostly device
Summary: can't clear --write-mostly when re-adding former --write-mostly device
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: mdadm
Version: 10
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Doug Ledford
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-30 03:47 UTC by Alexandre Oliva
Modified: 2008-12-05 04:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-12-05 04:09:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Alexandre Oliva 2008-09-30 03:47:39 UTC
There's no way to clear the --write-mostly flag in a RAID 1 device without clearing the superblock:

mdadm --add /dev/mdN --write-mostly /dev/sdaN
mdadm --fail /dev/mdN /dev/sdaN
mdadm --remove /dev/mdN /dev/sdaN
mdadm --add /dev/mdN /dev/sdaN
mdadm --examine /dev/sdaN | grep write-mostly
# huh?
mdadm --fail /dev/mdN /dev/sdaN
mdadm --remove /dev/mdN /dev/sdaN
mdadm --zero-superblock /dev/sdaN
mdadm --add /dev/mdN /dev/sdaN
mdadm --examine /dev/sdaN | grep write-mostly
# aah!

This is all right in theory, but if you're using bitmaps that would speed up the resync, zeroing the superblock defeats it.

Comment 1 Alexandre Oliva 2008-09-30 04:37:13 UTC
FTR, I sent a proposed (untested) patchlet to Neil Brown:

diff .prev/Manage.c ./Manage.c
--- .prev/Manage.c
+++ ./Manage.c
@@ -397,6 +397,8 @@ int Manage_subdevs(char *devname, int fd
 						disc.state = mdi.disk.state;
 						if (dv->writemostly)
 							disk.state |= 1 << MD_DISK_WRITEMOSTLY;
+ 						else
+ 							disk.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);

Comment 2 Bug Zapper 2008-11-26 03:16:49 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Alexandre Oliva 2008-12-05 04:09:26 UTC
Neil wrote me back some time ago mentioning he'd probably add this feature, but in a slightly different way.

In the mean time, I found out it's possible to clean the writemostly flag of a running md array by writing '-writemostly' to /sys/block/md${N}/md/dev-${component}/state.


Note You need to log in before you can comment on or make changes to this bug.