Whamcloud - gitweb
LU-7903 ptlrpc: leaked rs on difficult reply 96/22696/4
authorNiu Yawei <yawei.niu@intel.com>
Fri, 23 Sep 2016 04:06:25 +0000 (00:06 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 13 Oct 2016 23:36:23 +0000 (23:36 +0000)
commitbd1441b92e31cd3c01cc2453aa627d139a1207f7
tree02f3dbb595637215337e78ce5a3dd3743a6b305d
parent1bf196aaf5adb9a1c67886c0cd6a780ec6838040
LU-7903 ptlrpc: leaked rs on difficult reply

reply_out_callback() should call ptlrpc_schedule_difficult_reply()
to finalize the rs if it's already not on uncommitted list, otherwise,
the rs and the export held by rs could be leaked:

- target_send_reply() sends a difficult reply before the transaction
  committed, the reply is linked to scp_rep_active;

- export gets disconnected by umount or whatever reason,
  server_disconnect_export() is called to complete all outstanding
  replies, which will calls into ptlrpc_handle_rs() to dispose of
  the rs, so the rs is removed from the uncommitted list and
  LNetMDUnlink() is called to unlink the reply buffer and generate
  an unlink event;

- reply_out_callback() is called to process above unlink event,
  ptlrpc_schedule_difficult_reply() is supposed to be called to
  dispose of the rs finally. However, it could be skipped because of
  following flawed code snippet:

  if (!rs->rs_no_ack ||
      rs->rs_transno <= rs->rs_export->exp_obd->obd_last_committed)
          ptlrpc_schedule_difficult_reply(rs);

  The intention of above code is: if rs_no_ack is true (COS enabled),
  and transaction is not committed, we should rely on commit callback
  to release the rs. However, it overlooked the situation that rs
  could have been removed from the uncommitted list by disconnecting
  export.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I76d1a9e08c94340520fb731e8671b7b9205e0eb1
Reviewed-on: http://review.whamcloud.com/22696
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/events.c