signed int mo_acl :1;
signed int mo_compat_resname:1;
} mdt_opts;
-
+
/* lock to pretect epoch and write count
* because we need not allocate memory, spinlock is fast.
*/
const void *rr_eadata;
int rr_logcookielen;
const struct llog_cookie *rr_logcookies;
+ __u32 rr_flags;
+};
+enum mdt_reint_flag {
+ MRF_SETATTR_LOCKED = 1 << 0
};
enum {
/* transaction number of current request */
__u64 mti_transno;
__u32 mti_trans_flags;
-
+
/* readdir hint structure */
struct lu_rdpg mti_rdpg;
};
RETURN(0);
}
-static __u64 mdt_attr_valid_xlate(__u64 in)
+static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr)
{
__u64 out;
out |= LA_MTIME;
if (in & ATTR_CTIME)
out |= LA_CTIME;
+
+ if (in & ATTR_FROM_OPEN)
+ rr->rr_flags |= MRF_SETATTR_LOCKED;
+
in &= ~(ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|
- ATTR_ATIME|ATTR_MTIME|ATTR_CTIME);
+ ATTR_ATIME|ATTR_MTIME|ATTR_CTIME|ATTR_FROM_OPEN);
if (in != 0)
CERROR("Unknown attr bits: %#llx\n", in);
return out;
RETURN(-EFAULT);
rr->rr_fid1 = &rec->sa_fid;
- la->la_valid = mdt_attr_valid_xlate(rec->sa_valid);
+ la->la_valid = mdt_attr_valid_xlate(rec->sa_valid, rr);
la->la_mode = rec->sa_mode;
la->la_uid = rec->sa_uid;
la->la_gid = rec->sa_gid;
/* In the raw-setattr case, we lock the child inode.
* In the write-back case or if being called from open,
* the client holds a lock already.
- * We use the ATTR_FROM_OPEN flag to tell these cases apart. */
+ * We use the ATTR_FROM_OPEN (translated into MRF_SETATTR_LOCKED by
+ * mdt_setattr_unpack()) flag to tell these cases apart. */
static int mdt_reint_setattr(struct mdt_thread_info *info)
{
struct lu_attr *attr = &info->mti_attr.ma_attr;
struct md_object *next;
struct mdt_lock_handle *lh;
struct mdt_body *repbody;
- /*__u64 valid = attr->la_valid;*/
int rc;
ENTRY;
lh = &info->mti_lh[MDT_LH_PARENT];
lh->mlh_mode = LCK_EX;
- if (attr->la_valid & ATTR_FROM_OPEN) {
+ if (rr->rr_flags & MRF_SETATTR_LOCKED) {
mo = mdt_object_find(info->mti_ctxt, info->mti_mdt,
rr->rr_fid1);
} else {