Re: mdadm --assemble considers event count for spares
From: NeilBrown <hidden>
Date: 2013-06-03 23:51:24
Attachments
- signature.asc [application/pgp-signature] 828 bytes
From: NeilBrown <hidden>
Date: 2013-06-03 23:51:24
On Tue, 28 May 2013 13:50:49 +0300 Alexander Lyakas [off-list ref] wrote:
Neil, In my opinion (I may be wrong), a spare drive (raid_disk==-1) doesn't add any information to array assembly. It doesn't have a valid raid slot, and I don't see how its event count is relevant. I don't think a spare can help us much in figuring out array's latest state, which is what assembly code tries to do. So what I was thinking: mdadm --assemble doesn't consider spare drives (raid_disk=-1) at all. It simply skips over them in the initial loop after reading their superblocks. Perhaps it can keep them in a side list. Then array is assembled with non-spare drives only.
Sounds reasonable.
I would suggest looking at the place where 'most_recent' is set in
Assemble.c, and get it to avoid updating 'most_recent' if the current device
is a spare.
Something like
if (most_recent < devcnt) {
if (devices[devcnt].i.events
> devices[most_recent].i.events)
+ if (devices[devcnt].i.disk.state == 6)
most_recent = devcnt;
}
Care to give that a try?
NeilBrown
After array is assembled, we may choose one of the following: # User has to explicitly add the spare drives after array has been assembled. Assemble can warn that some spares have been left out, and tell the user what they are. # Assemble adds the spare drives (perhaps after zeroing their superblocks even), after it assembled the array with non-spare drives. Alex.