Whamcloud - gitweb
(1) fix error handling in mdd_create_data();
authorhuanghua <huanghua>
Tue, 12 Sep 2006 05:14:27 +0000 (05:14 +0000)
committerhuanghua <huanghua>
Tue, 12 Sep 2006 05:14:27 +0000 (05:14 +0000)
(2) do not assert in mdt_recovery().

lustre/mdd/mdd_handler.c
lustre/mdt/mdt_handler.c

index 4f21399..5d9772a 100644 (file)
@@ -1609,8 +1609,8 @@ static int mdd_create_data(const struct lu_context *ctxt,
                            const struct md_create_spec *spec,
                            struct md_attr *ma)
 {
-        struct mdd_device *mdd = mdo2mdd(pobj);
-        struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
+        struct mdd_device *mdd = mdo2mdd(cobj);
+        struct mdd_object *mdd_pobj = md2mdd_obj(pobj);/* XXX maybe NULL */
         struct mdd_object *son = md2mdd_obj(cobj);
         struct lu_attr    *attr = &ma->ma_attr;
         struct lov_mds_md *lmm = NULL;
@@ -1627,16 +1627,14 @@ static int mdd_create_data(const struct lu_context *ctxt,
         mdd_txn_param_build(ctxt, &MDD_TXN_CREATE_DATA);
         handle = mdd_trans_start(ctxt, mdd);
         if (IS_ERR(handle))
-                rc = PTR_ERR(handle);
-        else {
-                /*XXX: setting the lov ea is not locked
-                 * but setting the attr is locked? */
-                rc = mdd_lov_set_md(ctxt, mdd_pobj, son, lmm, lmm_size,
-                                    handle, 0);
-                if (rc == 0)
-                        rc = mdd_attr_get_internal_locked(ctxt, son, ma);
-        }
-out:
+                RETURN(rc = PTR_ERR(handle));
+
+        /*XXX: setting the lov ea is not locked
+         * but setting the attr is locked? */
+        rc = mdd_lov_set_md(ctxt, mdd_pobj, son, lmm, lmm_size, handle, 0);
+        if (rc == 0)
+               rc = mdd_attr_get_internal_locked(ctxt, son, ma);
+
         /* finish mdd_lov_create() stuff */
         mdd_lov_create_finish(ctxt, mdd, rc);
         mdd_trans_stop(ctxt, mdd, rc, handle);
index a4ccba6..763ce84 100644 (file)
@@ -1438,12 +1438,16 @@ static int mdt_recovery(struct ptlrpc_request *req)
 
         /* sanity check: if the xid matches, the request must be marked as a
          * resent or replayed */
-        LASSERTF(ergo(req->rq_xid == req_exp_last_xid(req) ||
-                      req->rq_xid == req_exp_last_close_xid(req),
-                      lustre_msg_get_flags(req->rq_reqmsg) &
-                      (MSG_RESENT | MSG_REPLAY)),
-                 "rq_xid "LPU64" matches last_xid, "
-                 "expected RESENT flag\n", req->rq_xid);
+        if (req->rq_xid == req_exp_last_xid(req) ||
+            req->rq_xid == req_exp_last_close_xid(req)) {
+                if (!(lustre_msg_get_flags(req->rq_reqmsg) &
+                      (MSG_RESENT | MSG_REPLAY))) {
+                        CERROR("rq_xid "LPU64" matches last_xid, "
+                                "expected RESENT flag\n", req->rq_xid);
+                        req->rq_status = -ENOTCONN;
+                        RETURN(-ENOTCONN);
+                }
+        }
 
         /* else: note the opposite is not always true; a RESENT req after a
          * failover will usually not match the last_xid, since it was likely