The imp_known_replied_xid is updated each time when we try to get the known replied xid by following function:
__u64 ptlrpc_known_replied_xid(struct obd_import *imp)
{
struct ptlrpc_request *req;
assert_spin_locked(&imp->imp_lock);
if (list_empty(&imp->imp_unreplied_list))
return 0;
req = list_entry(imp->imp_unreplied_list.next, struct ptlrpc_request,
rq_unreplied_list);
LASSERTF(req->rq_xid >= 1, "XID:%llu\n", req->rq_xid);
if (imp->imp_known_replied_xid < req->rq_xid - 1)
imp->imp_known_replied_xid = req->rq_xid - 1;
return req->rq_xid - 1;
}
Usually, the imp_known_replied_xid should be less than or equal to the miminal xid in unreplied list, one exception is resend-repaly request, on reconnection during recovery, we may resend an already replied replay request by re-adding it to unreplied list. The above function needs be amended to handle this case.