diff options
-rw-r--r-- | drivers/md/md.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3a8ef589d8c..17e2f526457 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7180,6 +7180,19 @@ void md_do_sync(struct mddev *mddev) rdev->recovery_offset < j) j = rdev->recovery_offset; rcu_read_unlock(); + + /* If there is a bitmap, we need to make sure all + * writes that started before we added a spare + * complete before we start doing a recovery. + * Otherwise the write might complete and (via + * bitmap_endwrite) set a bit in the bitmap after the + * recovery has checked that bit and skipped that + * region. + */ + if (mddev->bitmap) { + mddev->pers->quiesce(mddev, 1); + mddev->pers->quiesce(mddev, 0); + } } printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); |