From bfced13aa799eb9919a2c1f313f6c4954409747d Mon Sep 17 00:00:00 2001 From: jcl Date: Mon, 3 Jun 2013 17:01:51 +0200 Subject: [PATCH] LU-3432 llite: Access to released file trigs a restore When a client accesses data in a released file, or truncate it, client must trig a restore request. During this restore, the client must not glimpse and must use size from MDT. To bring the "restore is running" information on the client we add a new t_state bit field to mdt_info which will be used to carry transient file state. To memorise this information in the inode we add a new flag LLIF_FILE_RESTORING. Signed-off-by: JC Lafoucriere Change-Id: I4f3cde9cb247760075f6872b1d1c299ef369a7ae Reviewed-on: http://review.whamcloud.com/6537 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- lustre/include/cl_object.h | 6 +++- lustre/include/lustre/lustre_idl.h | 14 ++++++---- lustre/lclient/lcommon_cl.c | 6 ++++ lustre/llite/file.c | 54 ++++++++++++++++++++++++++++++------ lustre/llite/llite_internal.h | 3 ++ lustre/llite/llite_lib.c | 39 +++++++++++++++++++++++++- lustre/llite/vvp_io.c | 55 +++++++++++++++++++++++++++++++++---- lustre/lov/lov_io.c | 15 ++++++++-- lustre/mdt/mdt_handler.c | 14 +++++++++- lustre/mdt/mdt_hsm.c | 8 ++++-- lustre/mdt/mdt_internal.h | 9 ++++++ lustre/ptlrpc/pack_generic.c | 56 +++++++++++++++++++------------------- lustre/ptlrpc/wirehdr.c | 2 +- lustre/ptlrpc/wiretest.c | 14 ++++++---- lustre/tests/sanity.sh | 12 ++++++-- lustre/utils/wirecheck.c | 3 +- lustre/utils/wiretest.c | 16 ++++++----- 17 files changed, 253 insertions(+), 73 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 517ce27..db81fb1 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2390,7 +2390,11 @@ struct cl_io { * Right now, only two opertaions need to verify layout: glimpse * and setattr. */ - ci_verify_layout:1; + ci_verify_layout:1, + /** + * file is released, restore has to to be triggered by vvp layer + */ + ci_restore_needed:1; /** * Number of pages owned by this IO. For invariant checking. */ diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index a2dc8ab..86800eb 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1721,10 +1721,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) #define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */ #define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */ #define OBD_MD_MEA (0x0000000400000000ULL) /* CMD split EA */ - -/* OBD_MD_MDTIDX is used to get MDT index, but it is never been used overwire, - * and it is already obsolete since 2.3 */ -/* #define OBD_MD_MDTIDX (0x0000000800000000ULL) */ +#define OBD_MD_TSTATE (0x0000000800000000ULL) /* transient state field */ #define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */ #define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */ @@ -2205,6 +2202,11 @@ static inline int ll_inode_to_ext_flags(int iflags) } #endif +/* 64 possible states */ +enum md_transient_state { + MS_RESTORE = (1 << 0), /* restore is running */ +}; + struct mdt_body { struct lu_fid fid1; struct lu_fid fid2; @@ -2216,7 +2218,9 @@ struct mdt_body { obd_time ctime; __u64 blocks; /* XID, in the case of MDS_READPAGE */ __u64 ioepoch; - __u64 unused1; /* was "ino" until 2.4.0 */ + __u64 t_state; /* transient file state defined in + * enum md_transient_state + * was "ino" until 2.4.0 */ __u32 fsuid; __u32 fsgid; __u32 capability; diff --git a/lustre/lclient/lcommon_cl.c b/lustre/lclient/lcommon_cl.c index 96b8b3e..e0cc4ad 100644 --- a/lustre/lclient/lcommon_cl.c +++ b/lustre/lclient/lcommon_cl.c @@ -1038,6 +1038,12 @@ again: cl_io_fini(env, io); if (unlikely(io->ci_need_restart)) goto again; + /* HSM import case: file is released, cannot be restored + * no need to fail except if restore registration failed + * with -ENODATA */ + if (result == -ENODATA && io->ci_restore_needed && + io->ci_result != -ENODATA) + result = 0; cl_env_put(env, &refcheck); RETURN(result); } diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e0611c9..95e2c6b 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -927,7 +927,7 @@ out: cl_io_fini(env, io); /* If any bit been read/written (result != 0), we just return * short read/write instead of restart io. */ - if (result == 0 && io->ci_need_restart) { + if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n", iot == CIT_READ ? "read" : "write", file->f_dentry->d_name.name, *ppos, count); @@ -2801,13 +2801,13 @@ out: } int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, - __u64 ibits) + __u64 ibits) { - struct inode *inode = dentry->d_inode; - int rc; - ENTRY; + struct inode *inode = dentry->d_inode; + int rc; + ENTRY; - rc = __ll_inode_revalidate_it(dentry, it, ibits); + rc = __ll_inode_revalidate_it(dentry, it, ibits); if (rc != 0) RETURN(rc); @@ -2817,9 +2817,17 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, LTIME_S(inode->i_mtime) = ll_i2info(inode)->lli_lvb.lvb_mtime; LTIME_S(inode->i_ctime) = ll_i2info(inode)->lli_lvb.lvb_ctime; } else { - rc = ll_glimpse_size(inode); + /* In case of restore, the MDT has the right size and has + * already send it back without granting the layout lock, + * inode is up-to-date so glimpse is useless. + * Also to glimpse we need the layout, in case of a running + * restore the MDT holds the layout lock so the glimpse will + * block up to the end of restore (getattr will block) + */ + if (!(ll_i2info(inode)->lli_flags & LLIF_FILE_RESTORING)) + rc = ll_glimpse_size(inode); } - RETURN(rc); + RETURN(rc); } int ll_getattr_it(struct vfsmount *mnt, struct dentry *de, @@ -3305,6 +3313,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode, unlock_res_and_lock(lock); /* checking lvb_ready is racy but this is okay. The worst case is * that multi processes may configure the file on the same time. */ + if (lvb_ready || !reconf) { rc = -ENODATA; if (lvb_ready) { @@ -3484,3 +3493,32 @@ again: RETURN(rc); } + +/** + * This function send a restore request to the MDT + */ +int ll_layout_restore(struct inode *inode) +{ + struct hsm_user_request *hur; + int len, rc; + ENTRY; + + len = sizeof(struct hsm_user_request) + + sizeof(struct hsm_user_item); + OBD_ALLOC(hur, len); + if (hur == NULL) + RETURN(-ENOMEM); + + hur->hur_request.hr_action = HUA_RESTORE; + hur->hur_request.hr_archive_id = 0; + hur->hur_request.hr_flags = 0; + memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid, + sizeof(hur->hur_user_item[0].hui_fid)); + hur->hur_user_item[0].hui_extent.length = -1; + hur->hur_request.hr_itemcount = 1; + rc = obd_iocontrol(LL_IOC_HSM_REQUEST, cl_i2sbi(inode)->ll_md_exp, + len, hur, NULL); + OBD_FREE(hur, len); + RETURN(rc); +} + diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 8e139ab..0915797 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -123,6 +123,8 @@ enum lli_flags { LLIF_SRVLOCK = (1 << 5), /* File data is modified. */ LLIF_DATA_MODIFIED = (1 << 6), + /* File is being restored */ + LLIF_FILE_RESTORING = (1 << 7), }; struct ll_inode_info { @@ -1616,5 +1618,6 @@ enum { int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); int ll_layout_refresh(struct inode *inode, __u32 *gen); +int ll_layout_restore(struct inode *inode); #endif /* LLITE_INTERNAL_H */ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index ea33cda..c549b78 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1389,6 +1389,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) struct ll_inode_info *lli = ll_i2info(inode); struct md_op_data *op_data = NULL; struct md_open_data *mod = NULL; + bool file_is_released = false; int rc = 0, rc1 = 0; ENTRY; @@ -1473,10 +1474,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) op_data->op_flags = MF_EPOCH_OPEN; + /* truncate on a released file must failed with -ENODATA, + * so size must not be set on MDS for released file + * but other attributes must be set + */ + if (S_ISREG(inode->i_mode)) { + struct lov_stripe_md *lsm; + __u32 gen; + + ll_layout_refresh(inode, &gen); + lsm = ccc_inode_lsm_get(inode); + if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED) + file_is_released = true; + ccc_inode_lsm_put(inode, lsm); + } + + /* clear size attr for released file + * we clear the attribute send to MDT in op_data, not the original + * received from caller in attr which is used later to + * decide return code */ + if (file_is_released && (attr->ia_valid & ATTR_SIZE)) + op_data->op_attr.ia_valid &= ~ATTR_SIZE; + rc = ll_md_setattr(dentry, op_data, &mod); if (rc) GOTO(out, rc); + /* truncate failed, others succeed */ + if (file_is_released) { + if (attr->ia_valid & ATTR_SIZE) + GOTO(out, rc = -ENODATA); + else + GOTO(out, rc = 0); + } + /* RPC to MDT is sent, cancel data modification flag */ if (rc == 0 && (op_data->op_bias & MDS_DATA_MODIFIED)) { spin_lock(&lli->lli_lock); @@ -1490,7 +1521,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) if (attr->ia_valid & (ATTR_SIZE | ATTR_ATIME | ATTR_ATIME_SET | - ATTR_MTIME | ATTR_MTIME_SET)) + ATTR_MTIME | ATTR_MTIME_SET)) { /* For truncate and utimes sending attributes to OSTs, setting * mtime/atime to the past will be performed under PW [0:EOF] * extent lock (new_size:EOF for truncate). It may seem @@ -1498,6 +1529,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) * setting times to past, but it is necessary due to possible * time de-synchronization between MDT inode and OST objects */ rc = ll_setattr_ost(inode, attr); + } EXIT; out: if (op_data) { @@ -1800,6 +1832,11 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) LASSERT(md->oss_capa); ll_add_capa(inode, md->oss_capa); } + + if (body->valid & OBD_MD_TSTATE) { + if (body->t_state & MS_RESTORE) + lli->lli_flags |= LLIF_FILE_RESTORING; + } } void ll_read_inode2(struct inode *inode, void *opaque) diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 5a077a8..5bf9956 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -124,8 +124,38 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) CLOBINVRNT(env, obj, ccc_object_invariant(obj)); - CDEBUG(D_VFSTRACE, "ignore/verify layout %d/%d, layout version %d.\n", - io->ci_ignore_layout, io->ci_verify_layout, cio->cui_layout_gen); + CDEBUG(D_VFSTRACE, DFID" ignore/verify layout %d/%d, layout version %d " + "restore needed %d\n", + PFID(lu_object_fid(&obj->co_lu)), + io->ci_ignore_layout, io->ci_verify_layout, + cio->cui_layout_gen, io->ci_restore_needed); + + if (io->ci_restore_needed == 1) { + int rc; + + /* file was detected release, we need to restore it + * before finishing the io + */ + rc = ll_layout_restore(ccc_object_inode(obj)); + /* if restore registration failed, no restart, + * we will return -ENODATA */ + /* The layout will change after restore, so we need to + * block on layout lock hold by the MDT + * as MDT will not send new layout in lvb (see LU-3124) + * we have to explicitly fetch it, all this will be done + * by ll_layout_refresh() + */ + if (rc == 0) { + io->ci_restore_needed = 0; + io->ci_need_restart = 1; + io->ci_verify_layout = 1; + } else { + io->ci_restore_needed = 1; + io->ci_need_restart = 0; + io->ci_verify_layout = 0; + io->ci_result = rc; + } + } if (!io->ci_ignore_layout && io->ci_verify_layout) { __u32 gen = 0; @@ -133,9 +163,17 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) /* check layout version */ ll_layout_refresh(ccc_object_inode(obj), &gen); io->ci_need_restart = cio->cui_layout_gen != gen; - if (io->ci_need_restart) - CDEBUG(D_VFSTRACE, "layout changed from %d to %d.\n", - cio->cui_layout_gen, gen); + if (io->ci_need_restart) { + CDEBUG(D_VFSTRACE, + DFID" layout changed from %d to %d.\n", + PFID(lu_object_fid(&obj->co_lu)), + cio->cui_layout_gen, gen); + /* today successful restore is the only possible + * case */ + /* restore was done, clear restoring state */ + ll_i2info(ccc_object_inode(obj))->lli_flags &= + ~LLIF_FILE_RESTORING; + } } } @@ -1146,6 +1184,12 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, CLOBINVRNT(env, obj, ccc_object_invariant(obj)); ENTRY; + CDEBUG(D_VFSTRACE, DFID" ignore/verify layout %d/%d, layout version %d " + "restore needed %d\n", + PFID(lu_object_fid(&obj->co_lu)), + io->ci_ignore_layout, io->ci_verify_layout, + cio->cui_layout_gen, io->ci_restore_needed); + CL_IO_SLICE_CLEAN(cio, cui_cl); cl_io_slice_add(io, &cio->cui_cl, obj, &vvp_io_ops); vio->cui_ra_window_set = 0; @@ -1208,4 +1252,3 @@ static struct vvp_io *cl2vvp_io(const struct lu_env *env, cl2ccc_io(env, slice); return vvp_env_io(env); } - diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 8322798..5d2b455 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -984,14 +984,23 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj, LASSERTF(0, "invalid type %d\n", io->ci_type); case CIT_MISC: case CIT_FSYNC: - result = +1; + result = 1; break; case CIT_SETATTR: + /* the truncate to 0 is managed by MDT: + * - in open, for open O_TRUNC + * - in setattr, for truncate + */ + /* the truncate is for size > 0 so triggers a restore */ + if (cl_io_is_trunc(io)) + io->ci_restore_needed = 1; + result = -ENODATA; + break; case CIT_READ: case CIT_WRITE: case CIT_FAULT: - /* TODO: need to restore the file. */ - result = -EBADF; + io->ci_restore_needed = 1; + result = -ENODATA; break; } if (result == 0) { diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ca2090d..bcd644b 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -396,7 +396,12 @@ void mdt_pack_attr2body(struct mdt_thread_info *info, struct mdt_body *b, b->blocks = 0; /* if no object is allocated on osts, the size on mds is valid. b=22272 */ b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS; - } + } else if ((ma->ma_valid & MA_LOV) && ma->ma_lmm && + (ma->ma_lmm->lmm_pattern & LOV_PATTERN_F_RELEASED)) { + /* A released file stores its size on MDS. */ + b->blocks = 0; + b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS; + } if (fid) { b->fid1 = *fid; @@ -734,6 +739,13 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, RETURN(rc); } + /* if file is released, check if a restore is running */ + if ((ma->ma_valid & MA_HSM) && (ma->ma_hsm.mh_flags & HS_RELEASED) && + mdt_hsm_restore_is_running(info, mdt_object_fid(o))) { + repbody->t_state = MS_RESTORE; + repbody->valid |= OBD_MD_TSTATE; + } + is_root = lu_fid_eq(mdt_object_fid(o), &info->mti_mdt->mdt_md_root_fid); /* the Lustre protocol supposes to return default striping diff --git a/lustre/mdt/mdt_hsm.c b/lustre/mdt/mdt_hsm.c index b35e939..b4d10e6 100644 --- a/lustre/mdt/mdt_hsm.c +++ b/lustre/mdt/mdt_hsm.c @@ -52,7 +52,7 @@ #define MDT_HSM_FREE(ptr, size) OBD_FREE_LARGE((ptr), (size)) /* - * fake functions, will be replace by real one with HSM Coordinator patch + * fake functions, will be replaced by real one with HSM Coordinator patch */ int mdt_hsm_copytool_send(struct obd_export *exp) @@ -90,7 +90,7 @@ static int mdt_hsm_coordinator_actions(struct mdt_thread_info *info, __u64 *compound_id, int mti_attr_is_valid) { - return 0; + return -ENODATA; } /** @@ -553,7 +553,9 @@ int mdt_hsm_request(struct mdt_thread_info *info) rc = 0; MDT_HSM_FREE(hal, hal_size); - EXIT; + + GOTO(out_ucred, rc); + out_ucred: mdt_exit_ucred(info); return rc; diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 81b0b20..8b204de 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -908,6 +908,15 @@ int mdt_hsm_progress(struct mdt_thread_info *info); int mdt_hsm_ct_register(struct mdt_thread_info *info); int mdt_hsm_ct_unregister(struct mdt_thread_info *info); int mdt_hsm_request(struct mdt_thread_info *info); +/* HSM restore cannot be active yet, until the coordinator + * patch is landed, so this function always returns false for now, but + * allows the other parts of the code to start checking for this. + */ +static inline bool mdt_hsm_restore_is_running(struct mdt_thread_info *mti, + const struct lu_fid *fid) +{ + return false; +} /* mdt/mdt_hsm_cdt_actions.c */ extern const struct file_operations mdt_agent_actions_fops; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index a8b14ae..09ecfd9 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1869,35 +1869,35 @@ EXPORT_SYMBOL(lustre_swab_lquota_lvb); void lustre_swab_mdt_body (struct mdt_body *b) { - lustre_swab_lu_fid (&b->fid1); - lustre_swab_lu_fid (&b->fid2); - /* handle is opaque */ - __swab64s (&b->valid); - __swab64s (&b->size); - __swab64s (&b->mtime); - __swab64s (&b->atime); - __swab64s (&b->ctime); - __swab64s (&b->blocks); - __swab64s (&b->ioepoch); - CLASSERT(offsetof(typeof(*b), unused1) != 0); - __swab32s (&b->fsuid); - __swab32s (&b->fsgid); - __swab32s (&b->capability); - __swab32s (&b->mode); - __swab32s (&b->uid); - __swab32s (&b->gid); - __swab32s (&b->flags); - __swab32s (&b->rdev); - __swab32s (&b->nlink); + lustre_swab_lu_fid(&b->fid1); + lustre_swab_lu_fid(&b->fid2); + /* handle is opaque */ + __swab64s(&b->valid); + __swab64s(&b->size); + __swab64s(&b->mtime); + __swab64s(&b->atime); + __swab64s(&b->ctime); + __swab64s(&b->blocks); + __swab64s(&b->ioepoch); + __swab64s(&b->t_state); + __swab32s(&b->fsuid); + __swab32s(&b->fsgid); + __swab32s(&b->capability); + __swab32s(&b->mode); + __swab32s(&b->uid); + __swab32s(&b->gid); + __swab32s(&b->flags); + __swab32s(&b->rdev); + __swab32s(&b->nlink); CLASSERT(offsetof(typeof(*b), unused2) != 0); - __swab32s (&b->suppgid); - __swab32s (&b->eadatasize); - __swab32s (&b->aclsize); - __swab32s (&b->max_mdsize); - __swab32s (&b->max_cookiesize); - __swab32s (&b->uid_h); - __swab32s (&b->gid_h); - CLASSERT(offsetof(typeof(*b), padding_5) != 0); + __swab32s(&b->suppgid); + __swab32s(&b->eadatasize); + __swab32s(&b->aclsize); + __swab32s(&b->max_mdsize); + __swab32s(&b->max_cookiesize); + __swab32s(&b->uid_h); + __swab32s(&b->gid_h); + CLASSERT(offsetof(typeof(*b), padding_5) != 0); } EXPORT_SYMBOL(lustre_swab_mdt_body); diff --git a/lustre/ptlrpc/wirehdr.c b/lustre/ptlrpc/wirehdr.c index 3847dec..dc5e090 100644 --- a/lustre/ptlrpc/wirehdr.c +++ b/lustre/ptlrpc/wirehdr.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index bf5de44..ed024bd 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -54,8 +54,8 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux deva 2.6.32.279.lustre #5 SMP Tue Apr 9 22:52:17 CST 2013 x86_64 x86_64 x - * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) */ + * running on Linux centos6-bis 2.6.32-358.0.1.el6-head #3 SMP Wed Apr 17 17:37:43 CEST 2013 + * with gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) */ /* Constants... */ @@ -1340,6 +1340,8 @@ void lustre_assert_wire_constants(void) OBD_MD_REINT); LASSERTF(OBD_MD_MEA == (0x0000000400000000ULL), "found 0x%.16llxULL\n", OBD_MD_MEA); + LASSERTF(OBD_MD_TSTATE == (0x0000000800000000ULL), "found 0x%.16llxULL\n", + OBD_MD_TSTATE); LASSERTF(OBD_MD_FLXATTR == (0x0000001000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLXATTR); LASSERTF(OBD_MD_FLXATTRLS == (0x0000002000000000ULL), "found 0x%.16llxULL\n", @@ -1923,10 +1925,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mdt_body, blocks)); LASSERTF((int)sizeof(((struct mdt_body *)0)->blocks) == 8, "found %lld\n", (long long)(int)sizeof(((struct mdt_body *)0)->blocks)); - LASSERTF((int)offsetof(struct mdt_body, unused1) == 96, "found %lld\n", - (long long)(int)offsetof(struct mdt_body, unused1)); - LASSERTF((int)sizeof(((struct mdt_body *)0)->unused1) == 8, "found %lld\n", - (long long)(int)sizeof(((struct mdt_body *)0)->unused1)); + LASSERTF((int)offsetof(struct mdt_body, t_state) == 96, "found %lld\n", + (long long)(int)offsetof(struct mdt_body, t_state)); + LASSERTF((int)sizeof(((struct mdt_body *)0)->t_state) == 8, "found %lld\n", + (long long)(int)sizeof(((struct mdt_body *)0)->t_state)); LASSERTF((int)offsetof(struct mdt_body, fsuid) == 104, "found %lld\n", (long long)(int)offsetof(struct mdt_body, fsuid)); LASSERTF((int)sizeof(((struct mdt_body *)0)->fsuid) == 4, "found %lld\n", diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index a679db8..20c2d04 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11176,7 +11176,6 @@ test_229() { # LU-2482, LU-3448 [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)" stat $DIR/$tfile || error "failed to stat released file" - # Truncate should fail. $TRUNCATE $DIR/$tfile 200000 && error "truncate of released file should fail" @@ -11188,9 +11187,18 @@ test_229() { # LU-2482, LU-3448 stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe failed" [ $stripe_count -eq 2 ] || error "after trunc: ($stripe_count)" + chown $RUNAS_ID $DIR/$tfile || + error "chown $RUNAS_ID $DIR/$tfile failed" + + chgrp $RUNAS_ID $DIR/$tfile || + error "chgrp $RUNAS_ID $DIR/$tfile failed" + + touch $DIR/$tfile || + error "touch $DIR/$tfile failed" + rm $DIR/$tfile || error "failed to remove released file" } -run_test 229 "getstripe/stat/rm work on released files (stripe count = 2)" +run_test 229 "getstripe/stat/rm/attr changes work on released files" test_230a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index d49a433..742de0d 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -592,6 +592,7 @@ check_obdo(void) CHECK_DEFINE_64X(OBD_MD_MDS); CHECK_DEFINE_64X(OBD_MD_REINT); CHECK_DEFINE_64X(OBD_MD_MEA); + CHECK_DEFINE_64X(OBD_MD_TSTATE); CHECK_DEFINE_64X(OBD_MD_FLXATTR); CHECK_DEFINE_64X(OBD_MD_FLXATTRLS); CHECK_DEFINE_64X(OBD_MD_FLXATTRRM); @@ -870,7 +871,7 @@ check_mdt_body(void) CHECK_MEMBER(mdt_body, atime); CHECK_MEMBER(mdt_body, ctime); CHECK_MEMBER(mdt_body, blocks); - CHECK_MEMBER(mdt_body, unused1); + CHECK_MEMBER(mdt_body, t_state); CHECK_MEMBER(mdt_body, fsuid); CHECK_MEMBER(mdt_body, fsgid); CHECK_MEMBER(mdt_body, capability); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 106ac3a..5bb959a 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -62,8 +62,8 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux deva 2.6.32.279.lustre #5 SMP Tue Apr 9 22:52:17 CST 2013 x86_64 x86_64 x - * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) */ + * running on Linux centos6-bis 2.6.32-358.0.1.el6-head #3 SMP Wed Apr 17 17:37:43 CEST 2013 + * with gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) */ /* Constants... */ @@ -1348,6 +1348,8 @@ void lustre_assert_wire_constants(void) OBD_MD_REINT); LASSERTF(OBD_MD_MEA == (0x0000000400000000ULL), "found 0x%.16llxULL\n", OBD_MD_MEA); + LASSERTF(OBD_MD_TSTATE == (0x0000000800000000ULL), "found 0x%.16llxULL\n", + OBD_MD_TSTATE); LASSERTF(OBD_MD_FLXATTR == (0x0000001000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLXATTR); LASSERTF(OBD_MD_FLXATTRLS == (0x0000002000000000ULL), "found 0x%.16llxULL\n", @@ -1931,10 +1933,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mdt_body, blocks)); LASSERTF((int)sizeof(((struct mdt_body *)0)->blocks) == 8, "found %lld\n", (long long)(int)sizeof(((struct mdt_body *)0)->blocks)); - LASSERTF((int)offsetof(struct mdt_body, unused1) == 96, "found %lld\n", - (long long)(int)offsetof(struct mdt_body, unused1)); - LASSERTF((int)sizeof(((struct mdt_body *)0)->unused1) == 8, "found %lld\n", - (long long)(int)sizeof(((struct mdt_body *)0)->unused1)); + LASSERTF((int)offsetof(struct mdt_body, t_state) == 96, "found %lld\n", + (long long)(int)offsetof(struct mdt_body, t_state)); + LASSERTF((int)sizeof(((struct mdt_body *)0)->t_state) == 8, "found %lld\n", + (long long)(int)sizeof(((struct mdt_body *)0)->t_state)); LASSERTF((int)offsetof(struct mdt_body, fsuid) == 104, "found %lld\n", (long long)(int)offsetof(struct mdt_body, fsuid)); LASSERTF((int)sizeof(((struct mdt_body *)0)->fsuid) == 4, "found %lld\n", -- 1.8.3.1