diff options
author | NeilBrown | 2005-08-04 21:53:35 +0200 |
---|---|---|
committer | Linus Torvalds | 2005-08-04 22:00:54 +0200 |
commit | 6b8b3e8a8b3e62b4209eaa36697e3c9df457e196 (patch) | |
tree | 8b537e5b358cbe93cd8e8ea54a9281d56a7ce205 /drivers/md | |
parent | [PATCH] md: yet another attempt to get bitmap-based resync to do the right th... (diff) | |
download | kernel-qcow2-linux-6b8b3e8a8b3e62b4209eaa36697e3c9df457e196.tar.gz kernel-qcow2-linux-6b8b3e8a8b3e62b4209eaa36697e3c9df457e196.tar.xz kernel-qcow2-linux-6b8b3e8a8b3e62b4209eaa36697e3c9df457e196.zip |
[PATCH] md: make sure md bitmap updates are flushed when array is stopped.
The recent change to never ignore the bitmap, revealed that the bitmap isn't
begin flushed properly when an array is stopped.
We call bitmap_daemon_work three times as there is a three-stage pipeline for
flushing updates to the bitmap file.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bitmap.c | 23 | ||||
-rw-r--r-- | drivers/md/md.c | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 09d32db06d20..41df4cda66e2 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -1451,6 +1451,29 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset) } /* + * flush out any pending updates + */ +void bitmap_flush(mddev_t *mddev) +{ + struct bitmap *bitmap = mddev->bitmap; + int sleep; + + if (!bitmap) /* there was no bitmap */ + return; + + /* run the daemon_work three time to ensure everything is flushed + * that can be + */ + sleep = bitmap->daemon_sleep; + bitmap->daemon_sleep = 0; + bitmap_daemon_work(bitmap); + bitmap_daemon_work(bitmap); + bitmap_daemon_work(bitmap); + bitmap->daemon_sleep = sleep; + bitmap_update_sb(bitmap); +} + +/* * free memory that was allocated */ void bitmap_destroy(mddev_t *mddev) diff --git a/drivers/md/md.c b/drivers/md/md.c index 9fd4dbea0d0d..480f658db6f2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1798,6 +1798,8 @@ static int do_md_stop(mddev_t * mddev, int ro) goto out; mddev->ro = 1; } else { + bitmap_flush(mddev); + wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0); if (mddev->ro) set_disk_ro(disk, 0); blk_queue_make_request(mddev->queue, md_fail_request); |