From 544fe041246a8324c0c1c49d05392836ac350507 Mon Sep 17 00:00:00 2001 From: pschwan Date: Wed, 1 May 2002 15:44:11 +0000 Subject: [PATCH] Avoid cli_lock deadlock in ptlrpc_free_req --- lustre/ptlrpc/client.c | 6 ++++-- lustre/ptlrpc/recovd.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 341b51ca..e66aa053 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -292,9 +292,11 @@ void ptlrpc_free_committed(struct ptlrpc_client *cli) CDEBUG(D_INFO, "Marking request %p as committed (" "transno=%Lu, last_committed=%Lu\n", req, req->rq_transno, cli->cli_last_committed); - if (atomic_dec_and_test(&req->rq_refcount)) + if (atomic_dec_and_test(&req->rq_refcount)) { + /* we do this to prevent free_req deadlock */ + req->rq_client = NULL; ptlrpc_free_req(req); - else + } else list_add(&req->rq_list, &cli->cli_dying_head); } } diff --git a/lustre/ptlrpc/recovd.c b/lustre/ptlrpc/recovd.c index af917f1..9547816 100644 --- a/lustre/ptlrpc/recovd.c +++ b/lustre/ptlrpc/recovd.c @@ -46,6 +46,7 @@ void recovd_cli_fail(struct ptlrpc_client *cli) EXIT; } +/* this function must be called with cli->cli_lock held */ void recovd_cli_fixed(struct ptlrpc_client *cli) { ENTRY; -- 1.8.3.1