Whamcloud - gitweb
- workaround for name collision in mdt_obj_create() + debug CERROR there
authoralex <alex>
Fri, 21 May 2004 08:43:35 +0000 (08:43 +0000)
committeralex <alex>
Fri, 21 May 2004 08:43:35 +0000 (08:43 +0000)
- mds_commitrw() should use l_dput() instead of f_dput()
- removed needless CERROR() from mds_create_local_dentry()

lustre/mds/handler.c
lustre/mds/mds_lmv.c
lustre/mds/mds_reint.c

index 761760d..4279f54 100644 (file)
@@ -1171,7 +1171,6 @@ static char *reint_names[] = {
 
 static int mdt_obj_create(struct ptlrpc_request *req)
 {
-        unsigned int tmpname = ll_insecure_random_int();
         struct ldlm_res_id res_id = { .name = {0} };
         struct obd_export *exp = req->rq_export;
         struct obd_device *obd = exp->exp_obd;
@@ -1184,6 +1183,7 @@ static int mdt_obj_create(struct ptlrpc_request *req)
         struct obd_run_ctxt saved;
         ldlm_policy_data_t policy;
         int mealen, flags = 0;
+        unsigned int tmpname;
         struct obd_ucred uc;
         struct dentry *new;
         struct mea *mea;
@@ -1207,12 +1207,22 @@ static int mdt_obj_create(struct ptlrpc_request *req)
 
         repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody));
 
+repeat:
         handle = fsfilt_start(obd, parent_inode, FSFILT_OP_MKDIR, NULL);
         LASSERT(!IS_ERR(handle));
 
+        tmpname = ll_insecure_random_int();
         sprintf(fidname, "%u", tmpname);
         new = simple_mkdir(mds->mds_objects_dir, fidname,
                         body->oa.o_mode, 1);
+        if (IS_ERR(new)) {
+                CERROR("%s: can't create new inode %s) for mkdir: %d\n",
+                       obd->obd_name, fidname, (int) PTR_ERR(new));
+                if (PTR_ERR(new) == -EEXIST) {
+                        fsfilt_commit(obd, parent_inode, handle, 0);
+                        goto repeat;
+                }
+        }
         LASSERT(!IS_ERR(new));
         LASSERT(new->d_inode != NULL);
 
index c4ea3af..d61a0f3 100644 (file)
@@ -618,7 +618,7 @@ int mds_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
 
         for (i = 0, lnb = res; i < obj->ioo_bufcnt; i++, lnb++)
                 __free_page(lnb->page);
-        f_dput(res->dentry);
+        l_dput(res->dentry);
 
         RETURN(rc);
 }
index bb56334..24c249f 100644 (file)
@@ -1314,7 +1314,7 @@ int mds_create_local_dentry(struct mds_update_record *rec,
 
         if (new_child->d_inode != NULL) {
                 /* nice. we've already have local dentry! */
-                CERROR("found dentry in FIDS/: %u/%u\n", 
+                CDEBUG(D_OTHER, "found dentry in FIDS/: %u/%u\n", 
                        (unsigned) new_child->d_inode->i_ino,
                        (unsigned) new_child->d_inode->i_generation);
                 rec->ur_fid1->id = fids_dir->i_ino;