From ef81737b5de01fd8b54c693125e0a3fe9f00e217 Mon Sep 17 00:00:00 2001 From: zam <zam> Date: Tue, 9 Dec 2008 18:39:22 +0000 Subject: [PATCH] Branch HEAD b=17461 i=r.read i=tappro avoid nesting of obd_uncommitted_replies and rs_lock locks in ptlrpc_handle_rs. --- lustre/ptlrpc/service.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 07e3c80ec8..cb101cf6c1 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1598,19 +1598,19 @@ ptlrpc_handle_rs (struct ptlrpc_reply_state *rs) list_del_init (&rs->rs_exp_list); spin_unlock (&exp->exp_lock); - spin_lock(&rs->rs_lock); - - been_handled = rs->rs_handled; - rs->rs_handled = 1; - - if (!list_empty(&rs->rs_obd_list)) { - spin_unlock(&rs->rs_lock); + /* Avoid obd_uncommitted_replies_lock contention if we 100% sure that + * rs has been removed from the list already */ + if (!list_empty_careful(&rs->rs_obd_list)) { spin_lock(&obd->obd_uncommitted_replies_lock); - spin_lock(&rs->rs_lock); list_del_init(&rs->rs_obd_list); spin_unlock(&obd->obd_uncommitted_replies_lock); } + spin_lock(&rs->rs_lock); + + been_handled = rs->rs_handled; + rs->rs_handled = 1; + nlocks = rs->rs_nlocks; /* atomic "steal", but */ rs->rs_nlocks = 0; /* locks still on rs_locks! */ -- GitLab