Commit 4c43c27d authored by Alexander Boyko's avatar Alexander Boyko Committed by Greg Kroah-Hartman

staging: lustre: ptlrpc: skip lock if export failed

This patch resolves IO vs eviction race.
After eviction failed export stayed at stale list,
a client had IO processing and reconnected during it.
A client sent brw rpc with last lock cookie and new connection.
The lock with failed export was found and assert was happened.
 (ost_handler.c:1812:ost_prolong_lock_one())
  ASSERTION( lock->l_export == opd->opd_exp ) failed:

 1. Skip the lock at ldlm_handle2lock if lock export failed.
 2. Validation of lock for IO was added at hpreq_check(). The lock
    searching is based on granted interval tree. If server doesn`t
    have a valid lock, it reply to client with ESTALE.
Signed-off-by: default avatarAlexander Boyko <alexander.boyko@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7702
Seagate-bug-id: MRP-2787
Reviewed-on: http://review.whamcloud.com/18120Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarVitaly Fertman <vitaly.fertman@seagate.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f5b9d55
...@@ -533,6 +533,13 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, ...@@ -533,6 +533,13 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,
if (!lock) if (!lock)
return NULL; return NULL;
if (lock->l_export && lock->l_export->exp_failed) {
CDEBUG(D_INFO, "lock export failed: lock %p, exp %p\n",
lock, lock->l_export);
LDLM_LOCK_PUT(lock);
return NULL;
}
/* It's unlikely but possible that someone marked the lock as /* It's unlikely but possible that someone marked the lock as
* destroyed after we did handle2object on it * destroyed after we did handle2object on it
*/ */
......
...@@ -1264,20 +1264,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt, ...@@ -1264,20 +1264,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt,
*/ */
if (req->rq_ops->hpreq_check) { if (req->rq_ops->hpreq_check) {
rc = req->rq_ops->hpreq_check(req); rc = req->rq_ops->hpreq_check(req);
/** if (rc == -ESTALE) {
* XXX: Out of all current req->rq_status = rc;
* ptlrpc_hpreq_ops::hpreq_check(), only ptlrpc_error(req);
* ldlm_cancel_hpreq_check() can return an error code; }
* other functions assert in similar places, which seems /** can only return error,
* odd. What also does not seem right is that handlers * 0 for normal request,
* for those RPCs do not assert on the same checks, but * or 1 for high priority request
* rather handle the error cases. e.g. see
* ost_rw_hpreq_check(), and ost_brw_read(),
* ost_brw_write().
*/ */
if (rc < 0) LASSERT(rc <= 1);
return rc;
LASSERT(rc == 0 || rc == 1);
} }
spin_lock_bh(&req->rq_export->exp_rpc_lock); spin_lock_bh(&req->rq_export->exp_rpc_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment