Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd52b746 authored by Dan Williams's avatar Dan Williams Committed by NeilBrown
Browse files

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: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 7c44ece9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2167,9 +2167,10 @@ static void md_update_sb(mddev_t * mddev, int force_change)
				rdev->recovery_offset = mddev->curr_resync_completed;

	}	
	if (mddev->external || !mddev->persistent) {
		clear_bit(MD_CHANGE_DEVS, &mddev->flags);
	if (!mddev->persistent) {
		if (!mddev->external)
			clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
		clear_bit(MD_CHANGE_DEVS, &mddev->flags);
		wake_up(&mddev->sb_wait);
		return;
	}