Whamcloud - gitweb
LU-8765 ptlrpc: update replay cursor when close during replay 18/23418/4
authorNiu Yawei <yawei.niu@intel.com>
Thu, 27 Oct 2016 06:38:58 +0000 (02:38 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 1 Jan 2017 02:00:03 +0000 (02:00 +0000)
commit1e8dfacb6f58d875d7840eb89a3af3e780659367
tree9b61da5d549747e257834d5da16e898af6849828
parent2d1be90507fc1f42f565d9e672c634b3855cb978
LU-8765 ptlrpc: update replay cursor when close during replay

The replay cursor should be updated properly when close happened
during replay, otherwise, ptlrpc_replay_next() could run into a
dead loop due to an invalid replay cursor:

- replay cursor is moved to an open request during replay;
- application close that open file, so the rq_replay of the open
  request is cleared;
- ptlrpc_replay_next() calls ptlrpc_free_committed() to free
  committed/closed requests, the open request is removed from
  the committed list, so the replay cursor is changed to an
  empty list_head now. The open request won't be freed now since
  it's still held by the pending close request;
- ptlrpc_replay_next() continue to move the replay cursor to
  next and run into a dead loop at the end;

Another change in this patch is to remove the out of date comments
in ptlrpc_replay_next() and cover the whole process of finding
replay request within imp_lock, because:

1. With two separated replay lists and replay cursor introduced,
   finding replay request won't take much time as before, it's
   not necessary to do this "lock -> unlock -> lock -> unlock"
   trick anymore;

2. Nowadays there are various kind of non-replay requests are
   allowed during recovery, so ptlrpc_free_committed() may run in
   parallel to remove an open request while ptlrpc_replay_next()
   is iterating the open requests list;

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I358c4f55dbf38b0c9122c3aff40cf9ec96619d6a
Reviewed-on: https://review.whamcloud.com/23418
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/client.c
lustre/ptlrpc/recover.c