From: huanghua Date: Mon, 14 Aug 2006 10:51:28 +0000 (+0000) Subject: (1) remove MD_ATTR_FLAGS. this is set by LA_FLAGS; X-Git-Tag: v1_8_0_110~486^2~1188 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e1d6eb68f40c2c2cba3ef85a61735c6e3be43696;p=fs%2Flustre-release.git (1) remove MD_ATTR_FLAGS. this is set by LA_FLAGS; (2) atime/mtime/ctime typo in OSD; (3) use our new valid bits in MDD entirely; (4) some other small fixes; --- diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 242993b..8c8b089 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -68,8 +68,7 @@ enum md_attr_flags { MD_ATIME_SET = 1 << 0, MD_MTIME_SET = 1 << 1, MD_CTIME_SET = 1 << 2, - MD_ATTR_FLAG = 1 << 3, - MD_ATTR_RAW = 1 << 4 + MD_ATTR_RAW = 1 << 3 }; /* additional parameters for create */ diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index d9dbc50..47c9041 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -604,23 +604,22 @@ static int __mdd_xattr_set(const struct lu_context *ctxt, struct mdd_object *o, int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj, const struct md_attr *ma) { - time_t now = CURRENT_SECONDS; - struct lu_attr *la = (struct lu_attr *)&ma->ma_attr; - struct lu_attr *tmp_la = &mdd_ctx_info(ctxt)->mti_la; + struct lu_attr *la = (struct lu_attr*)&ma->ma_attr; + struct lu_attr *tmp_la = &mdd_ctx_info(ctxt)->mti_la; struct dt_object *next = mdd_object_child(obj); - int rc = 0; + time_t now = CURRENT_SECONDS; + int rc = 0; ENTRY; rc = next->do_ops->do_attr_get(ctxt, next, tmp_la); if (rc) RETURN(rc); - if (!(ma->ma_attr_flags & ATTR_CTIME_SET)) + if (!(ma->ma_attr_flags & MD_CTIME_SET)) la->la_ctime = now; - - if (!(ma->ma_attr_flags & ATTR_ATIME_SET)) + if (!(ma->ma_attr_flags & MD_ATIME_SET)) la->la_atime = now; - if (!(ma->ma_attr_flags & ATTR_MTIME_SET)) + if (!(ma->ma_attr_flags & MD_MTIME_SET)) la->la_mtime = now; /*XXX Check permission */ @@ -652,7 +651,7 @@ int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj, la->la_uid = tmp_la->la_uid; if (la->la_gid == (gid_t) -1) la->la_gid = tmp_la->la_gid; - if (!(la->la_valid & ATTR_MODE)) + if (!(la->la_valid & LA_MODE)) la->la_mode = tmp_la->la_mode; /* * If the user or group of a non-directory has been @@ -734,9 +733,7 @@ static int mdd_attr_set(const struct lu_context *ctxt, rc = mdd_fix_attr(ctxt, mdd_obj, ma); if (rc) GOTO(cleanup, rc); - if (ma->ma_attr_flags & MD_ATTR_FLAG) { /* ioctl */ - rc = -ENOTSUPP; - } else if (ma->ma_attr.la_valid) { /* setattr */ + if (ma->ma_attr.la_valid) { /* setattr */ mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK); rc = mdd_attr_set_internal(ctxt, mdd_obj, &ma->ma_attr, handle); mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK); diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index cc31a5c..4ecdee3 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -387,7 +387,7 @@ int mdd_lov_set_md(const struct lu_context *ctxt, struct mdd_object *pobj, rc = mdd_lov_set_dir_md(ctxt, child, lmmp, lmm_size, handle); } } - CDEBUG(D_INFO, "Set lov md %p size %d for fid "DFID" rc%d/n", + CDEBUG(D_INFO, "Set lov md %p size %d for fid "DFID" rc%d\n", lmmp, lmm_size, PFID(mdo2fid(child)), rc); RETURN(rc); } diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index 8d08e09..821e9f9 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -149,6 +149,8 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr, out |= LA_MTIME; if (in & ATTR_CTIME) out |= LA_CTIME; + if (in & ATTR_ATTR_FLAG) + out |= LA_FLAGS; if (in & ATTR_FROM_OPEN) rr->rr_flags |= MRF_SETATTR_LOCKED; @@ -162,9 +164,6 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr, if (in & ATTR_MTIME_SET) ma->ma_attr_flags |= MD_MTIME_SET; - if (in & ATTR_ATTR_FLAG) - ma->ma_attr_flags |= MD_ATTR_FLAG; - if (in & ATTR_RAW) ma->ma_attr_flags |= MD_ATTR_RAW; diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 86ab3a4..19fd034 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -462,8 +462,9 @@ int mdt_reint_open(struct mdt_thread_info *info) finish_open: if (result != 0 && created) { + int rc2; ma->ma_need = 0; - int rc2 = mdo_unlink(info->mti_ctxt, mdt_object_child(parent), + rc2 = mdo_unlink(info->mti_ctxt, mdt_object_child(parent), mdt_object_child(child), rr->rr_name, &info->mti_attr); if (rc2 != 0) diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index f8508aa..3436bd7 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -645,9 +645,9 @@ static int osd_inode_setattr(const struct lu_context *ctx, if (bits & LA_ATIME) inode->i_atime = *osd_inode_time(ctx, inode, attr->la_atime); if (bits & LA_CTIME) - inode->i_atime = *osd_inode_time(ctx, inode, attr->la_ctime); + inode->i_ctime = *osd_inode_time(ctx, inode, attr->la_ctime); if (bits & LA_MTIME) - inode->i_atime = *osd_inode_time(ctx, inode, attr->la_mtime); + inode->i_mtime = *osd_inode_time(ctx, inode, attr->la_mtime); if (bits & LA_SIZE) inode->i_size = attr->la_size; if (bits & LA_BLOCKS) diff --git a/lustre/tests/utime.c b/lustre/tests/utime.c index e05090e..be94e55 100644 --- a/lustre/tests/utime.c +++ b/lustre/tests/utime.c @@ -90,9 +90,9 @@ int main(int argc, char *argv[]) } if (st.st_atime != utb.actime ) { - fprintf(stderr, "%s: bad utime mtime %lu should be %lu\n", + fprintf(stderr, "%s: bad utime atime %lu should be %lu\n", prog, st.st_atime, utb.actime); - return 7; + return 8; } printf("%s: good utime mtimes %lu, atime %lu\n",