From 74678fcc65207e965b74466c254af4feec002984 Mon Sep 17 00:00:00 2001 From: shadow <shadow> Date: Thu, 24 Apr 2008 11:14:25 +0000 Subject: [PATCH] don't put request into delay list while invalidate in flight. restore generation check. b=15069 i=johan i=rread --- lustre/ChangeLog | 7 +++++++ lustre/mgc/mgc_request.c | 1 - lustre/ptlrpc/client.c | 33 ++++++++++++++++++++------------- lustre/ptlrpc/events.c | 2 -- lustre/ptlrpc/niobuf.c | 6 +----- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index e29af998ed..09be0432d7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -12,6 +12,13 @@ tbd Sun Microsystems, Inc. * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a removed cwd "./" (refer to Bugzilla 14399). +Severity : normal +Bugzilla : 15069 +Description: don't put request into delay list while invalidate in flight. +Details : ptlrpc_delay_request sometimes put in delay list while invalidate + import in flight. this produce timeout for invalidate and sometimes + can cause stale data. + Severity : minor Bugzilla : 14856 Frequency : on ppc only diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index ee5aaa9575..dab90012cd 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -868,7 +868,6 @@ static int mgc_import_event(struct obd_device *obd, switch (event) { case IMP_EVENT_DISCON: /* MGC imports should not wait for recovery */ - ptlrpc_invalidate_import(imp); break; case IMP_EVENT_INACTIVE: break; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 6e138034b1..f4b6a80eb6 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -663,26 +663,34 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, } else if (req->rq_send_state == LUSTRE_IMP_CONNECTING && imp->imp_state == LUSTRE_IMP_CONNECTING) { /* allow CONNECT even if import is invalid */ ; - } else if (imp->imp_invalid && (!imp->imp_recon_bk || - imp->imp_obd->obd_no_recov)) { + if (atomic_read(&imp->imp_inval_count) != 0) { + DEBUG_REQ(D_ERROR, req, "invalidate in flight"); + *status = -EIO; + } + + } else if ((imp->imp_invalid && (!imp->imp_recon_bk)) || + imp->imp_obd->obd_no_recov) { /* If the import has been invalidated (such as by an OST - * failure), and if the import(MGC) tried all of its connection - * list (Bug 13464), the request must fail with -ESHUTDOWN. + * failure), and if the import(MGC) tried all of its connection + * list (Bug 13464), the request must fail with -ESHUTDOWN. * This indicates the requests should be discarded; an -EIO - * may result in a resend of the request. */ + * may result in a resend of the request. */ if (!imp->imp_deactive) - DEBUG_REQ(D_ERROR, req, "IMP_INVALID"); + DEBUG_REQ(D_ERROR, req, "IMP_INVALID"); *status = -ESHUTDOWN; /* bz 12940 */ } else if (req->rq_import_generation != imp->imp_generation) { DEBUG_REQ(D_ERROR, req, "req wrong generation:"); *status = -EIO; } else if (req->rq_send_state != imp->imp_state) { - if (imp->imp_obd->obd_no_recov) - *status = -ESHUTDOWN; - else if (imp->imp_dlm_fake || req->rq_no_delay) + /* invalidate in progress - any requests should be drop */ + if (atomic_read(&imp->imp_inval_count) != 0) { + DEBUG_REQ(D_ERROR, req, "invalidate in flight"); + *status = -EIO; + } else if (imp->imp_dlm_fake || req->rq_no_delay) { *status = -EWOULDBLOCK; - else + } else { delay = 1; + } } RETURN(delay); @@ -1168,9 +1176,8 @@ check_ctx: libcfs_nid2str(imp->imp_connection->c_peer.nid), lustre_msg_get_opc(req->rq_reqmsg)); - set->set_remaining--; - atomic_dec(&imp->imp_inflight); + set->set_remaining--; cfs_waitq_signal(&imp->imp_recovery_waitq); } @@ -1758,8 +1765,8 @@ int ptlrpc_queue_wait(struct ptlrpc_request *req) req->rq_phase = RQ_PHASE_RPC; spin_lock(&imp->imp_lock); -restart: req->rq_import_generation = imp->imp_generation; +restart: if (ptlrpc_import_delay_req(imp, req, &rc)) { list_del(&req->rq_list); diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index affe7dd3c9..d24c92d477 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -69,8 +69,6 @@ void request_out_callback(lnet_event_t *ev) ptlrpc_wake_client_req(req); } - /* these balance the references in ptl_send_rpc() */ - atomic_dec(&req->rq_import->imp_inflight); ptlrpc_req_finished(req); EXIT; diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 8c9f09a586..d4c8fe04e9 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -505,9 +505,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_reply_portal); } - /* add references on request and import for request_out_callback */ + /* add references on request for request_out_callback */ ptlrpc_request_addref(request); - atomic_inc(&request->rq_import->imp_inflight); if (obd->obd_svc_stats != NULL) lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQACTIVE_CNTR, request->rq_import->imp_inflight.counter); @@ -528,10 +527,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) RETURN(rc); } - /* drop request_out_callback refs, we couldn't start the send */ - atomic_dec(&request->rq_import->imp_inflight); ptlrpc_req_finished(request); - if (noreply) RETURN(rc); else -- GitLab