Whamcloud - gitweb
Change LASSERTs to client eviction (i.e. abort client's recovery)
authordeen <deen>
Wed, 4 Jun 2008 17:56:05 +0000 (17:56 +0000)
committerdeen <deen>
Wed, 4 Jun 2008 17:56:05 +0000 (17:56 +0000)
because LASSERT on both the data supplied by a client, and the data
on disk is dangerous and incorrect.

b=15574
i=adilger
i=shadow

lustre/ChangeLog
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_open.c
lustre/mdt/mdt_recovery.c

index 57ae3e7..a332517 100644 (file)
@@ -1077,6 +1077,13 @@ Details    : skiplists are used to group compatible locks on granted list
              that was implemented as tracking first and last lock of each lock group
              the patch changes that to using doubly linked lists
 
+Severity   : normal
+Bugzilla   : 15574
+Description: MDS LBUG: ASSERTION(!IS_ERR(dchild))
+Details    : Change LASSERTs to client eviction (i.e. abort client's recovery)
+             because LASSERT on both the data supplied by a client, and the data 
+            on disk is dangerous and incorrect.
+
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
index aabf8d7..e2fd60c 100644 (file)
@@ -474,6 +474,13 @@ static inline const struct lu_fid *mdt_object_fid(struct mdt_object *o)
         return lu_object_fid(&o->mot_obj.mo_lu);
 }
 
+
+static inline void mdt_export_evict(struct obd_export *exp)
+{
+        class_fail_export(exp);
+        class_export_put(exp);
+}
+
 int mdt_get_disposition(struct ldlm_reply *rep, int flag);
 void mdt_set_disposition(struct mdt_thread_info *info,
                         struct ldlm_reply *rep, int flag);
index 6099b61..0ac88c4 100644 (file)
@@ -684,16 +684,35 @@ void mdt_reconstruct_open(struct mdt_thread_info *info,
                 GOTO(out, rc = req->rq_status);
 
         if (mdt_get_disposition(ldlm_rep, DISP_OPEN_CREATE)) {
+                struct obd_export *exp = req->rq_export;
                 /*
                  * We failed after creation, but we do not know in which step
                  * we failed. So try to check the child object.
                  */
                 parent = mdt_object_find(env, mdt, rr->rr_fid1);
-                LASSERT(!IS_ERR(parent));
-
+                if (IS_ERR(parent)) {
+                        rc = PTR_ERR(parent);
+                        LCONSOLE_WARN("Parent "DFID" lookup error %d."
+                                      " Evicting client %s with export %s.\n",
+                                      PFID(mdt_object_fid(parent)), rc,
+                                      obd_uuid2str(&exp->exp_client_uuid),
+                                      obd_export_nid2str(exp));
+                        mdt_export_evict(exp);
+                        EXIT;
+                        return;
+                }
                 child = mdt_object_find(env, mdt, rr->rr_fid2);
-                LASSERT(!IS_ERR(child));
-
+                if (IS_ERR(child)) {
+                        rc = PTR_ERR(parent);
+                        LCONSOLE_WARN("Child "DFID" lookup error %d."
+                                      " Evicting client %s with export %s.\n",
+                                      PFID(mdt_object_fid(child)), rc,
+                                      obd_uuid2str(&exp->exp_client_uuid),
+                                      obd_export_nid2str(exp));
+                        mdt_export_evict(exp);
+                        EXIT;
+                        return;
+                }
                 rc = mdt_object_exists(child);
                 if (rc > 0) {
                         struct md_object *next;
index ce27e10..3ca99be 100644 (file)
@@ -1084,7 +1084,8 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti,
                                    struct mdt_lock_handle *lhc)
 {
         struct ptlrpc_request  *req = mdt_info_req(mti);
-        struct mdt_export_data *med = &req->rq_export->exp_mdt_data;
+        struct obd_export *exp = req->rq_export;
+        struct mdt_export_data *med = &exp->exp_mdt_data;
         struct mdt_device *mdt = mti->mti_mdt;
         struct mdt_object *child;
         struct mdt_body *body;
@@ -1096,7 +1097,17 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti,
 
         /* if no error, so child was created with requested fid */
         child = mdt_object_find(mti->mti_env, mdt, mti->mti_rr.rr_fid2);
-        LASSERT(!IS_ERR(child));
+        if (IS_ERR(child)) {
+                rc = PTR_ERR(child);
+                LCONSOLE_WARN("Child "DFID" lookup error %d."
+                              " Evicting client %s with export %s.\n",
+                              PFID(mdt_object_fid(child)), rc,
+                              obd_uuid2str(&exp->exp_client_uuid),
+                              obd_export_nid2str(exp));
+                mdt_export_evict(exp);
+                EXIT;
+                return;
+        }
 
         body = req_capsule_server_get(mti->mti_pill, &RMF_MDT_BODY);
         rc = mo_attr_get(mti->mti_env, mdt_object_child(child), &mti->mti_attr);
@@ -1113,7 +1124,8 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,
                                     struct mdt_lock_handle *lhc)
 {
         struct ptlrpc_request  *req = mdt_info_req(mti);
-        struct mdt_export_data *med = &req->rq_export->exp_mdt_data;
+        struct obd_export *exp = req->rq_export;
+        struct mdt_export_data *med = &exp->exp_mdt_data;
         struct mdt_device *mdt = mti->mti_mdt;
         struct mdt_object *obj;
         struct mdt_body *body;
@@ -1124,7 +1136,17 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,
 
         body = req_capsule_server_get(mti->mti_pill, &RMF_MDT_BODY);
         obj = mdt_object_find(mti->mti_env, mdt, mti->mti_rr.rr_fid1);
-        LASSERT(!IS_ERR(obj));
+        if (IS_ERR(obj)) {
+                int rc = PTR_ERR(obj);
+                LCONSOLE_WARN(""DFID" lookup error %d."
+                              " Evicting client %s with export %s.\n",
+                              PFID(mdt_object_fid(obj)), rc,
+                              obd_uuid2str(&exp->exp_client_uuid),
+                              obd_export_nid2str(exp));
+                mdt_export_evict(exp);
+                EXIT;
+                return;
+        }
         mo_attr_get(mti->mti_env, mdt_object_child(obj), &mti->mti_attr);
         mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr,
                            mdt_object_fid(obj));