Whamcloud - gitweb
don't put request into delay list while invalidate in flight.
authorshadow <shadow>
Thu, 24 Apr 2008 11:14:25 +0000 (11:14 +0000)
committershadow <shadow>
Thu, 24 Apr 2008 11:14:25 +0000 (11:14 +0000)
restore generation check.
b=15069
i=johan
i=rread

lustre/ChangeLog
lustre/mgc/mgc_request.c
lustre/ptlrpc/client.c
lustre/ptlrpc/events.c
lustre/ptlrpc/niobuf.c

index e29af99..09be043 100644 (file)
@@ -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).
 
        * 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
 Severity   : minor
 Bugzilla   : 14856
 Frequency  : on ppc only
index ee5aaa9..dab9001 100644 (file)
@@ -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 */
         switch (event) {
         case IMP_EVENT_DISCON:
                 /* MGC imports should not wait for recovery */
-                ptlrpc_invalidate_import(imp);
                 break;
         case IMP_EVENT_INACTIVE:
                 break;
                 break;
         case IMP_EVENT_INACTIVE:
                 break;
index 6e13803..f4b6a80 100644 (file)
@@ -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 (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
                 /* 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
                  * 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)
                 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) {
                 *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;
                         *status = -EWOULDBLOCK;
-                else
+                } else {
                         delay = 1;
                         delay = 1;
+                }
         }
 
         RETURN(delay);
         }
 
         RETURN(delay);
@@ -1168,9 +1176,8 @@ check_ctx:
                        libcfs_nid2str(imp->imp_connection->c_peer.nid),
                        lustre_msg_get_opc(req->rq_reqmsg));
 
                        libcfs_nid2str(imp->imp_connection->c_peer.nid),
                        lustre_msg_get_opc(req->rq_reqmsg));
 
-                set->set_remaining--;
-
                 atomic_dec(&imp->imp_inflight);
                 atomic_dec(&imp->imp_inflight);
+                set->set_remaining--;
                 cfs_waitq_signal(&imp->imp_recovery_waitq);
         }
 
                 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);
         req->rq_phase = RQ_PHASE_RPC;
 
         spin_lock(&imp->imp_lock);
-restart:
         req->rq_import_generation = imp->imp_generation;
         req->rq_import_generation = imp->imp_generation;
+restart:
         if (ptlrpc_import_delay_req(imp, req, &rc)) {
                 list_del(&req->rq_list);
 
         if (ptlrpc_import_delay_req(imp, req, &rc)) {
                 list_del(&req->rq_list);
 
index affe7dd..d24c92d 100644 (file)
@@ -69,8 +69,6 @@ void request_out_callback(lnet_event_t *ev)
                 ptlrpc_wake_client_req(req);
         }
 
                 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;
         ptlrpc_req_finished(req);
 
         EXIT;
index 8c9f09a..d4c8fe0 100644 (file)
@@ -505,9 +505,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
                        request->rq_reply_portal);
         }
 
                        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);
         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);
         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);
         }
 
                 RETURN(rc);
         }
 
-         /* drop request_out_callback refs, we couldn't start the send */
-        atomic_dec(&request->rq_import->imp_inflight);
         ptlrpc_req_finished(request);
         ptlrpc_req_finished(request);
-
         if (noreply)
                 RETURN(rc);
         else
         if (noreply)
                 RETURN(rc);
         else