]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ceph: renew mon subscription before it expires
authorSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 17:25:46 +0000 (10:25 -0700)
committerSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 17:39:08 +0000 (10:39 -0700)
Be conservative: renew subscription once half the interval has expired.

Do not reuse sub expiration to control hunting.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/mon_client.c

index b0c95cec5df8f317d544d14834ba7b3c41ddf410..9c34df17fa4b792c4ce4a5a2a863538ade37e53f 100644 (file)
@@ -213,7 +213,7 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc,
                monc->hunting = false;
        }
        dout("handle_subscribe_ack after %d seconds\n", seconds);
-       monc->sub_renew_after = monc->sub_sent + seconds*HZ - 1;
+       monc->sub_renew_after = monc->sub_sent + (seconds >> 1)*HZ - 1;
        monc->sub_sent = 0;
        mutex_unlock(&monc->mutex);
        return;
@@ -512,7 +512,7 @@ static void delayed_work(struct work_struct *work)
        if (monc->want_mount) {
                __request_mount(monc);
        } else {
-               if (__sub_expired(monc)) {
+               if (monc->hunting) {
                        __close_session(monc);
                        __open_session(monc);  /* continue hunting */
                } else {