]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drbd: When proxy's buffer drained off go into regular resync mode
authorPhilipp Reisner <philipp.reisner@linbit.com>
Wed, 27 Oct 2010 15:32:36 +0000 (17:32 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:34:49 +0000 (11:34 +0100)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_worker.c

index 471331236826d5e0af66c1650165188d1500f25b..da02cce374c99d432e6c006bf69fb2ab698f9543 100644 (file)
@@ -973,7 +973,8 @@ struct drbd_conf {
        struct drbd_work  resync_work,
                          unplug_work,
                          go_diskless,
-                         md_sync_work;
+                         md_sync_work,
+                         start_resync_work;
        struct timer_list resync_timer;
        struct timer_list md_sync_timer;
 #ifdef DRBD_DEBUG_MD_SYNC
@@ -1546,6 +1547,7 @@ extern int w_prev_work_done(struct drbd_conf *, struct drbd_work *, int);
 extern int w_e_reissue(struct drbd_conf *, struct drbd_work *, int);
 extern int w_restart_disk_io(struct drbd_conf *, struct drbd_work *, int);
 extern int w_send_oos(struct drbd_conf *, struct drbd_work *, int);
+extern int w_start_resync(struct drbd_conf *, struct drbd_work *, int);
 
 extern void resync_timer_fn(unsigned long data);
 
index 0dc93f43a4760b18aceae473782c7df77dae6314..f49505cf8d0f47560dc7583c6ab24b209c2f067c 100644 (file)
@@ -2846,6 +2846,7 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
        INIT_LIST_HEAD(&mdev->unplug_work.list);
        INIT_LIST_HEAD(&mdev->go_diskless.list);
        INIT_LIST_HEAD(&mdev->md_sync_work.list);
+       INIT_LIST_HEAD(&mdev->start_resync_work.list);
        INIT_LIST_HEAD(&mdev->bm_io_work.w.list);
 
        mdev->resync_work.cb  = w_resync_inactive;
index 04a08e7541cceb895aa4ea7b83a0ae2e83076512..ee9238e593277e4f5a0a14c369cff577983ea728 100644 (file)
@@ -3279,6 +3279,7 @@ static int receive_sync_uuid(struct drbd_conf *mdev, enum drbd_packets cmd, unsi
 
        wait_event(mdev->misc_wait,
                   mdev->state.conn == C_WF_SYNC_UUID ||
+                  mdev->state.conn == C_BEHIND ||
                   mdev->state.conn < C_CONNECTED ||
                   mdev->state.disk < D_NEGOTIATING);
 
@@ -4338,6 +4339,14 @@ static int got_BarrierAck(struct drbd_conf *mdev, struct p_header80 *h)
 
        tl_release(mdev, p->barrier, be32_to_cpu(p->set_size));
 
+       if (mdev->state.conn == C_AHEAD &&
+           atomic_read(&mdev->ap_in_flight) == 0 &&
+           list_empty(&mdev->start_resync_work.list)) {
+                   struct drbd_work *w = &mdev->start_resync_work;
+                   w->cb = w_start_resync;
+                   drbd_queue_work_front(&mdev->data.work, w);
+       }
+
        return TRUE;
 }
 
index 67499077c4828de1cb2ba9e163232959e4452aa9..c9e7cb7c788abfd55623d45f21074a2d8b7ee78c 100644 (file)
@@ -742,6 +742,14 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
        return 1;
 }
 
+
+int w_start_resync(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
+{
+       drbd_start_resync(mdev, C_SYNC_SOURCE);
+
+       return 1;
+}
+
 int w_ov_finished(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
        kfree(w);
@@ -1472,7 +1480,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side)
        union drbd_state ns;
        int r;
 
-       if (mdev->state.conn >= C_SYNC_SOURCE) {
+       if (mdev->state.conn >= C_SYNC_SOURCE && mdev->state.conn < C_AHEAD) {
                dev_err(DEV, "Resync already running!\n");
                return;
        }