From eeb1a6b8f4fc044039fa2e5bc6373c59bbdb23d8 Mon Sep 17 00:00:00 2001 From: bobijam Date: Fri, 6 Mar 2009 05:53:24 +0000 Subject: [PATCH] Branch b_release_1_6_7 b=18154 i=alexey.lyashkov (shadow) i=johann always calls ptlrpc_import_recovery_state_machine() in invalidate_import_thread() because otherwise threads sleeping on the import's imp_recovery_waitq could be never woken up. --- lustre/ptlrpc/import.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index a5168d3..d9d754e 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -199,13 +199,13 @@ void ptlrpc_deactivate_import(struct obd_import *imp) ptlrpc_deactivate_and_unlock_import(imp); } -static unsigned int +static unsigned int ptlrpc_inflight_deadline(struct ptlrpc_request *req, time_t now) { long dl; if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) || - (req->rq_phase == RQ_PHASE_BULK) || + (req->rq_phase == RQ_PHASE_BULK) || (req->rq_phase == RQ_PHASE_NEW))) return 0; @@ -268,19 +268,19 @@ void ptlrpc_invalidate_import(struct obd_import *imp) LASSERT(imp->imp_invalid); /* Wait forever until inflight == 0. We really can't do it another - * way because in some cases we need to wait for very long reply + * way because in some cases we need to wait for very long reply * unlink. We can't do anything before that because there is really * no guarantee that some rdma transfer is not in progress right now. */ do { - /* Calculate max timeout for waiting on rpcs to error + /* Calculate max timeout for waiting on rpcs to error * out. Use obd_timeout if calculated value is smaller * than it. */ timeout = ptlrpc_inflight_timeout(imp); timeout += timeout / 3; - + if (timeout == 0) timeout = obd_timeout; - + CDEBUG(D_RPCTRACE, "Sleeping %d sec for inflight to error out\n", timeout); @@ -300,19 +300,19 @@ void ptlrpc_invalidate_import(struct obd_import *imp) spin_lock(&imp->imp_lock); list_for_each_safe(tmp, n, &imp->imp_sending_list) { - req = list_entry(tmp, struct ptlrpc_request, + req = list_entry(tmp, struct ptlrpc_request, rq_list); DEBUG_REQ(D_ERROR, req, "still on sending list"); } list_for_each_safe(tmp, n, &imp->imp_delayed_list) { - req = list_entry(tmp, struct ptlrpc_request, + req = list_entry(tmp, struct ptlrpc_request, rq_list); DEBUG_REQ(D_ERROR, req, "still on delayed list"); } - + if (atomic_read(&imp->imp_unregistering) == 0) { - /* XXX: This is temporary workaround for long - * connect interpret due to locking in lov in + /* XXX: This is temporary workaround for long + * connect interpret due to locking in lov in * in import activation path, which causes * connect rpc stay on sending list longer * time. Let's wait longer insread of asserting @@ -328,7 +328,7 @@ void ptlrpc_invalidate_import(struct obd_import *imp) * is no unregistering and inflight != 0 this * is bug. */ LASSERT(atomic_read(&imp->imp_inflight) == 0); - + /* Let's save one loop as soon as inflight have * dropped to zero. No new inflights possible at * this point. */ @@ -1157,7 +1157,6 @@ static int signal_completed_replay(struct obd_import *imp) static int ptlrpc_invalidate_import_thread(void *data) { struct obd_import *imp = data; - int disconnect; ENTRY; @@ -1169,13 +1168,6 @@ static int ptlrpc_invalidate_import_thread(void *data) ptlrpc_invalidate_import(imp); - /* is client_disconnect_export in flight ? */ - spin_lock(&imp->imp_lock); - disconnect = imp->imp_deactive; - spin_unlock(&imp->imp_lock); - if (disconnect) - GOTO(out, 0 ); - if (obd_dump_on_eviction) { CERROR("dump the log upon eviction\n"); libcfs_debug_dumplog(); @@ -1184,7 +1176,6 @@ static int ptlrpc_invalidate_import_thread(void *data) IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); ptlrpc_import_recovery_state_machine(imp); -out: class_import_put(imp); RETURN(0); } -- 1.8.3.1