Whamcloud - gitweb
(1) set attributes for newly created object and its parent;
authorhuanghua <huanghua>
Tue, 8 Aug 2006 06:54:49 +0000 (06:54 +0000)
committerhuanghua <huanghua>
Tue, 8 Aug 2006 06:54:49 +0000 (06:54 +0000)
(2) only pass S_IFREG to server if it is an open intent lock.

lustre/mdc/mdc_locks.c
lustre/mdd/mdd_handler.c
lustre/mdt/mdt_open.c

index 11099b4..6d23228 100644 (file)
@@ -304,7 +304,7 @@ int mdc_enqueue(struct obd_export *exp,
 //                          ldlm_it2str(it->it_op), it_name, it_inode->i_ino);
 
         if (it->it_op & IT_OPEN) {
-                it->it_create_mode |= S_IFREG;
+                it->it_create_mode = (it->it_create_mode & ~S_IFMT) | S_IFREG;
 
                 size[req_buffers++] = sizeof(struct mdt_rec_create);
                 size[req_buffers++] = op_data->namelen + 1;
index 41a8ecb..957eca8 100644 (file)
@@ -1012,8 +1012,30 @@ static int __mdd_object_initialize(const struct lu_context *ctxt,
                                    struct mdd_object *child,
                                    struct md_attr *ma, struct thandle *handle)
 {
-        int rc = 0;
+        struct dt_object *dt_parent = mdd_object_child(parent);
+        struct dt_object *dt_child = mdd_object_child(child);
+        int               rc;
         ENTRY;
+
+        /* update attributes for child and parent.
+         * FIXME: 
+         *  (1) the valid bits should be converted between Lustre and Linux;
+         *  (2) maybe, the child attributes should be set in OSD when creation.
+         */
+        ma->ma_attr.la_valid = ATTR_UID   | ATTR_GID   | ATTR_ATIME |
+                               ATTR_MTIME | ATTR_CTIME;
+        rc = dt_child->do_ops->do_attr_set(ctxt, dt_child, 
+                                           &ma->ma_attr, handle);
+        if (rc != 0)
+                RETURN(rc);
+
+        ma->ma_attr.la_valid = ATTR_MTIME | ATTR_CTIME;
+        rc = dt_parent->do_ops->do_attr_set(ctxt, dt_parent, 
+                                            &ma->ma_attr, handle);
+        if (rc != 0)
+                RETURN(rc);
+
+
         if (S_ISDIR(ma->ma_attr.la_mode)) {
                 /* add . and .. for newly created dir */
                 __mdd_ref_add(ctxt, child, handle);
index ed6133d..febc65a 100644 (file)
@@ -390,9 +390,10 @@ int mdt_reint_open(struct mdt_thread_info *info)
         /*TODO: remove this and add MDS_CHECK_RESENT if resent enabled*/
         LASSERT(info->mti_pill.rc_fmt == &RQF_LDLM_INTENT_OPEN);
 
-        CDEBUG(D_INODE, "I am going to create "DFID3"/("DFID3":%s) flag=%x\n",
+        CDEBUG(D_INODE, "I am going to create "DFID3"/("DFID3":%s) "
+                        "flag=%x mode=%06o\n",
                         PFID3(rr->rr_fid1), PFID3(rr->rr_fid2), 
-                        rr->rr_name, la->la_flags);
+                        rr->rr_name, la->la_flags, la->la_mode);
 
         ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
         intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD);