From: huanghua Date: Tue, 8 Aug 2006 06:54:49 +0000 (+0000) Subject: (1) set attributes for newly created object and its parent; X-Git-Tag: v1_8_0_110~486^2~1236 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=30ab3827d3a89d5f8f4e8f468b653831b7837023;p=fs%2Flustre-release.git (1) set attributes for newly created object and its parent; (2) only pass S_IFREG to server if it is an open intent lock. --- diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 11099b4..6d23228 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -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; diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 41a8ecb..957eca8 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -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); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index ed6133d..febc65a 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -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);