Whamcloud - gitweb
pass parent fid to the remote server in cross-ref case to insert proper dotdot
authortappro <tappro>
Sat, 26 Aug 2006 09:38:20 +0000 (09:38 +0000)
committertappro <tappro>
Sat, 26 Aug 2006 09:38:20 +0000 (09:38 +0000)
entry in the created subdirectory

lustre/cmm/mdc_object.c
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_reint.c

index f3bcba9..316f6f5 100644 (file)
@@ -170,7 +170,9 @@ static int mdc_object_create(const struct lu_context *ctx,
         ENTRY;
 
         mci = mdc_info_init(ctx);
-        mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        mci->mci_opdata.fid2 = *lu_object_fid(&mo->mo_lu);
+        /* parent fid is needed to create dotdot on the remote node */
+        mci->mci_opdata.fid1 = *(spec->u.sp_pfid);
         mci->mci_opdata.mod_time = la->la_mtime;
 
         /* get data from spec */
index 92d1dbf..b71aaea 100644 (file)
@@ -229,19 +229,21 @@ static int mdt_create_unpack(struct mdt_thread_info *info)
                 attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID |
                                  LA_CTIME | LA_MTIME | LA_ATIME;
                 info->mti_spec.sp_cr_flags = rec->cr_flags;
-
+                
                 rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
-                if (rr->rr_name) {
+                if (S_ISDIR(attr->la_mode)) {
+                        /* pass parent fid for cross-ref cases */
+                        info->mti_spec.u.sp_pfid = rr->rr_fid1;
+                } else if (S_ISLNK(attr->la_mode)) {
+                        const char *tgt = NULL;
                         if (req_capsule_field_present(pill, &RMF_SYMTGT)) {
-                                const char *tgt;
                                 tgt = req_capsule_client_get(pill,
                                                              &RMF_SYMTGT);
-                                if (tgt == NULL)
-                                        result = -EFAULT;
                                 info->mti_spec.u.sp_symname = tgt;
                         }
-                } else
-                        result = -EFAULT;
+                        if (tgt == NULL)
+                                result = -EFAULT;
+                } 
         } else
                 result = -EFAULT;
         RETURN(result);
index 555ff3a..89e4831 100644 (file)
@@ -92,7 +92,7 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
 
         repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
 
-        o = mdt_object_find(info->mti_ctxt, mdt, info->mti_rr.rr_fid1);
+        o = mdt_object_find(info->mti_ctxt, mdt, info->mti_rr.rr_fid2);
         if (!IS_ERR(o)) {
                 struct md_object *next = mdt_object_child(o);
 
@@ -414,7 +414,7 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
                                     rr->rr_fid2, rr->rr_tgt);
         else
                 rc = mdo_name_insert(info->mti_ctxt, mdt_object_child(mtgtdir),
-                                     rr->rr_tgt, rr->rr_fid2);
+                                     rr->rr_tgt, rr->rr_fid2, 0 /* FIXME */);
         GOTO(out_unlock_tgt, rc);
 
 out_unlock_tgt: