Whamcloud - gitweb
Fix mis-patch in lov_connect/lov_disconnect.
authoradilger <adilger>
Sun, 8 Aug 2004 07:34:57 +0000 (07:34 +0000)
committeradilger <adilger>
Sun, 8 Aug 2004 07:34:57 +0000 (07:34 +0000)
Add debugging to reconstruct_open() for bug 4181.

lustre/lov/lov_obd.c
lustre/mds/handler.c
lustre/mds/mds_open.c
lustre/mds/mds_reint.c

index e063d48..94cf673 100644 (file)
@@ -210,8 +210,8 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
         struct obd_export *exp;
-        int rc, rc2, i;
         struct proc_dir_entry *lov_proc_dir;
+        int rc, rc2, i;
         ENTRY;
 
         rc = class_connect(conn, obd, cluuid);
@@ -228,6 +228,14 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
                 RETURN(0);
         }
 
+        lov_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
+                                        NULL, NULL);
+        if (IS_ERR(lov_proc_dir)) {
+                CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
+                       obd->obd_type->typ_name, obd->obd_name);
+                lov_proc_dir = NULL;
+        }
+
         /* connect_flags is the MDS number, save for use in lov_add_obd */
         lov->lov_connect_flags = connect_flags;
         for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
@@ -330,14 +338,6 @@ static int lov_disconnect(struct obd_export *exp, int flags)
         if (lov->refcount != 0)
                 goto out_local;
 
-        lov_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
-                                        NULL, NULL);
-        if (IS_ERR(lov_proc_dir)) {
-                CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
-                       obd->obd_type->typ_name, obd->obd_name);
-                lov_proc_dir = NULL;
-        }
-
         for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
                 if (tgt->ltd_exp)
                         lov_disconnect_obd(obd, tgt, flags);
index 33dbe70..5182b53 100644 (file)
@@ -867,10 +867,9 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
 
         LASSERT(!strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME));
 
-        /* Swab now, before anyone looks inside the request */
-
         MDS_UPDATE_COUNTER((&obd->u.mds), MDS_GETATTR_NAME_COUNT);
 
+        /* Swab now, before anyone looks inside the request */
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
         if (body == NULL) {
index 53b1689..9074f3b 100644 (file)
@@ -497,25 +497,23 @@ static void reconstruct_open(struct mds_update_record *rec, int offset,
         }
 
         parent = mds_fid2dentry(mds, rec->ur_fid1, NULL);
-        LASSERT(!IS_ERR(parent));
+        LASSERTF(!IS_ERR(parent), "fid "LPU64"/%u rc %ld\n", rec->ur_fid1->id,
+                 rec->ur_fid1->generation, PTR_ERR(parent));
 
         child = ll_lookup_one_len(rec->ur_name, parent, rec->ur_namelen - 1);
-        LASSERT(!IS_ERR(child));
+        LASSERTF(!IS_ERR(child), "parent "LPU64"/%u child %s rc %ld\n",
+                 rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
+                 PTR_ERR(child));
 
-        if (!child->d_inode) {
+        if (!child->d_inode)
                 GOTO(out_dput, 0); /* child not present to open */
-        }
 
         /* At this point, we know we have a child. We'll send
-         * it back _unless_ it not created and open failed.
-         */
+         * it back _unless_ it not created and open failed.  */
         if (intent_disposition(rep, DISP_OPEN_OPEN) &&
             !intent_disposition(rep, DISP_OPEN_CREATE) &&
-            req->rq_status) {
+            req->rq_status)
                 GOTO(out_dput, 0);
-        }
-
-        /* get lock (write for O_CREAT, read otherwise) */
 
         mds_pack_inode2fid(obd, &body->fid1, child->d_inode);
         mds_pack_inode2body(obd, body, child->d_inode);
@@ -1054,11 +1052,10 @@ got_child:
                 rc = fsfilt_setattr(obd, dparent, handle, &iattr, 0);
                 if (rc)
                         CERROR("error on parent setattr: rc = %d\n", rc);
+                else
+                        MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
 
                 acc_mode = 0;           /* Don't check for permissions */
-                if (rc == 0) {
-                        MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
-                }
         }
 
         LASSERT(!mds_inode_is_orphan(dchild->d_inode));
index 0a993f8..457f327 100644 (file)
@@ -875,13 +875,12 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                 rc = fsfilt_setattr(obd, dparent, handle, &iattr, 0);
                 if (rc)
                         CERROR("error on parent setattr: rc = %d\n", rc);
+                else
+                        MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
 
                 body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
                 mds_pack_inode2fid(obd, &body->fid1, inode);
                 mds_pack_inode2body(obd, body, inode);
-                if (rc == 0) {
-                        MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
-                }
         }
         EXIT;
 
@@ -1654,7 +1653,6 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
 
         MDS_UPDATE_COUNTER(mds, MDS_UNLINK_COUNT);
 
-
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_UNLINK))
                 GOTO(cleanup, rc = -ENOENT);
 
@@ -2108,7 +2106,6 @@ static int mds_reint_link(struct mds_update_record *rec, int offset,
         MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
         
         MDS_UPDATE_COUNTER(mds, MDS_LINK_COUNT);
-
         
 //      memset(tgt_dir_lockh, 0, 2*sizeof(tgt_dir_lockh[0]));
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_LINK))