Re: [PATCH 2/2] imsm: FIX: Be more patient during loading matadata
From: Dan Williams <hidden>
Date: 2011-04-14 08:36:00
On 4/14/2011 1:08 AM, NeilBrown wrote:
quoted
Why does this existing check: /* retry the load if we might have raced against mdmon */ if (err == 3&& mdmon_running(devnum)) for (retry = 0; retry< 3; retry++) { usleep(3000); err = load_and_parse_mpb(dfd, s, NULL, 1); if (err != 3) break; }It's pretty horrible that we need to do this, isn't it?
Yes.
Maybe we need some way to synchronise with mdmon so we *know* if we have raced or not. i.e. mdmon keeps a count of the number of times it has updated the metadata. We send a message to get the count, read, then get the count again. The request blocks while mdmon is actually writing. If the counts are different, we read again. ??
Assuming we are only racing against dirty transitions maybe it is enough to poll md/array_state and if it signaled while reading the metadata we likely need to try again (of course with an intervening ping_monitor)? -- Dan