Bug 464743 - can't clear --write-mostly when re-adding former --write-mostly device
can't clear --write-mostly when re-adding former --write-mostly device
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: mdadm (Show other bugs)
10
All Linux
medium Severity medium
: ---
: ---
Assigned To: Doug Ledford
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-29 23:47 EDT by Alexandre Oliva
Modified: 2008-12-04 23:09 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-04 23:09:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alexandre Oliva 2008-09-29 23:47:39 EDT
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 00:37:13 EDT
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-25 22:16:49 EST
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-04 23:09:26 EST
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.