#17 ‘sanlock client renewal’ output does not meet expectations
Closed by teigland. Opened by 1007947985abcd.

The following function, when sanlock renewal is successful, does not set the fields 'next_ errors' and 'next_timeouts' to 0. If a renewal fails once, it will result in a non-zero 'next_ errors' or 'next_timeouts' always existing in the history.
This will lead to an issue where the latest renewal record we read shows a failed renewal.(But in reality, it was successful.)

static void save_renewal_history(struct space sp, int delta_result,
uint64_t last_success, int rd_ms, int wr_ms)
{
struct renewal_history
hi;

if (!sp->renewal_history_size || !sp->renewal_history)
    return;
if (delta_result == SANLK_OK) {
    hi = &sp->renewal_history[sp->renewal_history_next];
    hi->timestamp = last_success;
    hi->read_ms = rd_ms;
    hi->write_ms = wr_ms;
    sp->renewal_history_prev = sp->renewal_history_next;
    sp->renewal_history_next++;
    if (sp->renewal_history_next >= sp->renewal_history_size)
        sp->renewal_history_next = 0;
} else {
    hi = &sp->renewal_history[sp->renewal_history_prev];
    if (delta_result == SANLK_AIO_TIMEOUT)
        hi->next_timeouts++;
    else
        hi->next_errors++;
}

}


Thanks, fixed in https://pagure.io/sanlock/c/f88c4bc3d13fc988c753fa2e9bf044253912f48f?branch=master

Metadata Update from @teigland:
- Issue status updated to: Closed (was: Open)

Metadata