Skip to content

Commit 2d097e5

Browse files
Alexander Boykogregkh
authored andcommitted
staging: lustre: ptlrpc: skip lock if export failed
[ Upstream commit 4c43c27ddc461d8473cedd70f2549614641dfbc7 ] 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: Alexander 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/18120 Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Vitaly Fertman <vitaly.fertman@seagate.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent efa8f1b commit 2d097e5

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

drivers/staging/lustre/lustre/ldlm/ldlm_lock.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,13 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,
550550
if (lock == NULL)
551551
return NULL;
552552

553+
if (lock->l_export && lock->l_export->exp_failed) {
554+
CDEBUG(D_INFO, "lock export failed: lock %p, exp %p\n",
555+
lock, lock->l_export);
556+
LDLM_LOCK_PUT(lock);
557+
return NULL;
558+
}
559+
553560
/* It's unlikely but possible that someone marked the lock as
554561
* destroyed after we did handle2object on it */
555562
if (flags == 0 && ((lock->l_flags & LDLM_FL_DESTROYED) == 0)) {

drivers/staging/lustre/lustre/ptlrpc/service.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,20 +1240,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt,
12401240
* it may hit swab race at LU-1044. */
12411241
if (req->rq_ops->hpreq_check) {
12421242
rc = req->rq_ops->hpreq_check(req);
1243-
/**
1244-
* XXX: Out of all current
1245-
* ptlrpc_hpreq_ops::hpreq_check(), only
1246-
* ldlm_cancel_hpreq_check() can return an error code;
1247-
* other functions assert in similar places, which seems
1248-
* odd. What also does not seem right is that handlers
1249-
* for those RPCs do not assert on the same checks, but
1250-
* rather handle the error cases. e.g. see
1251-
* ost_rw_hpreq_check(), and ost_brw_read(),
1252-
* ost_brw_write().
1243+
if (rc == -ESTALE) {
1244+
req->rq_status = rc;
1245+
ptlrpc_error(req);
1246+
}
1247+
/** can only return error,
1248+
* 0 for normal request,
1249+
* or 1 for high priority request
12531250
*/
1254-
if (rc < 0)
1255-
return rc;
1256-
LASSERT(rc == 0 || rc == 1);
1251+
LASSERT(rc <= 1);
12571252
}
12581253

12591254
spin_lock_bh(&req->rq_export->exp_rpc_lock);

0 commit comments

Comments
 (0)