Commit 02851e9f authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

drbd: move bitmap write from resync_finished to after_state_change

We must not call it directly from resync_finished,
as we may be in either receiver or worker context there.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 84e7c0f7
...@@ -1548,6 +1548,9 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, ...@@ -1548,6 +1548,9 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED) if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED)
drbd_send_state(mdev); drbd_send_state(mdev);
if (os.conn > C_CONNECTED && ns.conn == C_CONNECTED)
drbd_queue_bitmap_io(mdev, &drbd_bm_write, NULL, "write from resync_finished");
/* free tl_hash if we Got thawed and are C_STANDALONE */ /* free tl_hash if we Got thawed and are C_STANDALONE */
if (ns.conn == C_STANDALONE && !is_susp(ns) && mdev->tl_hash) if (ns.conn == C_STANDALONE && !is_susp(ns) && mdev->tl_hash)
drbd_free_tl_hash(mdev); drbd_free_tl_hash(mdev);
...@@ -3860,13 +3863,16 @@ int drbd_bmio_clear_n_write(struct drbd_conf *mdev) ...@@ -3860,13 +3863,16 @@ int drbd_bmio_clear_n_write(struct drbd_conf *mdev)
static int w_bitmap_io(struct drbd_conf *mdev, struct drbd_work *w, int unused) static int w_bitmap_io(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{ {
struct bm_io_work *work = container_of(w, struct bm_io_work, w); struct bm_io_work *work = container_of(w, struct bm_io_work, w);
int rv; int rv = -EIO;
D_ASSERT(atomic_read(&mdev->ap_bio_cnt) == 0); D_ASSERT(atomic_read(&mdev->ap_bio_cnt) == 0);
drbd_bm_lock(mdev, work->why); if (get_ldev(mdev)) {
rv = work->io_fn(mdev); drbd_bm_lock(mdev, work->why);
drbd_bm_unlock(mdev); rv = work->io_fn(mdev);
drbd_bm_unlock(mdev);
put_ldev(mdev);
}
clear_bit(BITMAP_IO, &mdev->flags); clear_bit(BITMAP_IO, &mdev->flags);
smp_mb__after_clear_bit(); smp_mb__after_clear_bit();
......
...@@ -907,9 +907,6 @@ int drbd_resync_finished(struct drbd_conf *mdev) ...@@ -907,9 +907,6 @@ int drbd_resync_finished(struct drbd_conf *mdev)
drbd_md_sync(mdev); drbd_md_sync(mdev);
dev_info(DEV, "Writing changed bitmap pages\n");
drbd_queue_bitmap_io(mdev, &drbd_bm_write, NULL, "write from resync_finished");
if (khelper_cmd) if (khelper_cmd)
drbd_khelper(mdev, khelper_cmd); drbd_khelper(mdev, khelper_cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment