read-only arrays should stay that way as much as possible.
Updating the metadata - which could be triggered by a re-add
while assembling the array metadata - should be avoided.
Signed-off-by: NeilBrown <neilb@suse.de>
        bitmap_flush(mddev);
        md_super_wait(mddev);
 
-       if (!mddev->in_sync || mddev->flags) {
+       if (mddev->ro == 0 &&
+           (!mddev->in_sync || mddev->flags)) {
                /* mark array as shutdown cleanly */
                mddev->in_sync = 1;
                md_update_sb(mddev, 1);