md: don't clear MD_CHANGE_CLEAN in md_update_sb() for external arrays

If this bit is cleared in md_update_sb() the kernel will allow writes to the
array if userspace triggers md_allow_write(), e.g. through stripe_cache_size,
when mdmon is not active.  When mdmon is active the array transitions to
active-idle bypassing write-pending, setting up a race for mdmon to set the
array clean before a write arrives.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Dan Williams 2010-08-30 17:33:33 +10:00 коммит произвёл NeilBrown
Родитель 7c44ece988
Коммит bd52b74626
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -2167,9 +2167,10 @@ repeat:
rdev->recovery_offset = mddev->curr_resync_completed;
}
if (mddev->external || !mddev->persistent) {
if (!mddev->persistent) {
if (!mddev->external)
clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
clear_bit(MD_CHANGE_DEVS, &mddev->flags);
clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
wake_up(&mddev->sb_wait);
return;
}