- fixed declation of OBD_MD.. flags. They should be declared like the following:
#define OBD_MD_FLALL (0xffffffffffffffffLL)
to show compiller explicitly that they are 64bit value and should considered as such.
- fixed md_reint_rename(). It should first check if objects are the same then check if tgt is subdir of src because for the same inodes is_subdir() returns 1 and mds_reint_rename() for renaming object into itself it returned -EINVAL;
- added asserts in LMV checking if body->valid contains valid fid before accessing it to check if object is splitted.
- in lmv_intent.c after md_intent_lock() checking not only error code, but also disposition, because there are cases when we're interested in name which does not exist, lock is not taken and policy_res2 is cleared in mds_intent_policy(). In this case we should do nothing (especially access body->id1 in LMV), but exit. This is because body->id1 is zero and (body->valid & OBD_MD_FID) == 0 because say mds_getattr_lock() failed before filling out as inode is not found.
struct lov_ost_data_v0 lmm_objects[0];
} __attribute__((packed));
-#define OBD_MD_FLALL (0xffffffffffffffff)
-#define OBD_MD_FLID (0x0000000000000001) /* object ID */
-#define OBD_MD_FLATIME (0x0000000000000002) /* access time */
-#define OBD_MD_FLMTIME (0x0000000000000004) /* data modification time */
-#define OBD_MD_FLCTIME (0x0000000000000008) /* change time */
-#define OBD_MD_FLSIZE (0x0000000000000010) /* size */
-#define OBD_MD_FLBLOCKS (0x0000000000000020) /* allocated blocks count */
-#define OBD_MD_FLBLKSZ (0x0000000000000040) /* block size */
-#define OBD_MD_FLMODE (0x0000000000000080) /* access bits (mode & ~S_IFMT) */
-#define OBD_MD_FLTYPE (0x0000000000000100) /* object type (mode & S_IFMT) */
-#define OBD_MD_FLUID (0x0000000000000200) /* user ID */
-#define OBD_MD_FLGID (0x0000000000000400) /* group ID */
-#define OBD_MD_FLFLAGS (0x0000000000000800) /* flags word */
-#define OBD_MD_FLNLINK (0x0000000000002000) /* link count */
-#define OBD_MD_FLGENER (0x0000000000004000) /* generation number */
-#define OBD_MD_FLINLINE (0x0000000000008000) /* inline data */
-#define OBD_MD_FLRDEV (0x0000000000010000) /* device number */
-#define OBD_MD_FLEASIZE (0x0000000000020000) /* extended attribute data */
-#define OBD_MD_LINKNAME (0x0000000000040000) /* symbolic link target */
-#define OBD_MD_FLHANDLE (0x0000000000080000) /* file handle */
-#define OBD_MD_FLCKSUM (0x0000000000100000) /* bulk data checksum */
-#define OBD_MD_FLQOS (0x0000000000200000) /* quality of service stats */
-#define OBD_MD_FLOSCOPQ (0x0000000000400000) /* osc opaque data */
-#define OBD_MD_FLCOOKIE (0x0000000000800000) /* log cancellation cookie */
-#define OBD_MD_FLGROUP (0x0000000001000000) /* group */
-#define OBD_MD_FLIFID (0x0000000002000000) /* ->ost write inline fid */
-#define OBD_MD_FLEPOCH (0x0000000004000000) /* ->ost write easize is epoch */
-#define OBD_MD_FLGRANT (0x0000000008000000) /* ost preallocation space grant */
-#define OBD_MD_MDS (0x0000000010000000) /* where an inode lives on */
-#define OBD_MD_FLDIREA (0x0000000020000000) /* dir's extended attribute data */
-#define OBD_MD_REINT (0x0000000040000000) /* reintegrate oa */
+#define OBD_MD_FLALL (0xffffffffffffffffLL)
+#define OBD_MD_FLID (0x0000000000000001LL) /* object ID */
+#define OBD_MD_FLATIME (0x0000000000000002LL) /* access time */
+#define OBD_MD_FLMTIME (0x0000000000000004LL) /* data modification time */
+#define OBD_MD_FLCTIME (0x0000000000000008LL) /* change time */
+#define OBD_MD_FLSIZE (0x0000000000000010LL) /* size */
+#define OBD_MD_FLBLOCKS (0x0000000000000020LL) /* allocated blocks count */
+#define OBD_MD_FLBLKSZ (0x0000000000000040LL) /* block size */
+#define OBD_MD_FLMODE (0x0000000000000080LL) /* access bits (mode & ~S_IFMT) */
+#define OBD_MD_FLTYPE (0x0000000000000100LL) /* object type (mode & S_IFMT) */
+#define OBD_MD_FLUID (0x0000000000000200LL) /* user ID */
+#define OBD_MD_FLGID (0x0000000000000400LL) /* group ID */
+#define OBD_MD_FLFLAGS (0x0000000000000800LL) /* flags word */
+#define OBD_MD_FLNLINK (0x0000000000002000LL) /* link count */
+#define OBD_MD_FLGENER (0x0000000000004000LL) /* generation number */
+#define OBD_MD_FLINLINE (0x0000000000008000LL) /* inline data */
+#define OBD_MD_FLRDEV (0x0000000000010000LL) /* device number */
+#define OBD_MD_FLEASIZE (0x0000000000020000LL) /* extended attribute data */
+#define OBD_MD_LINKNAME (0x0000000000040000LL) /* symbolic link target */
+#define OBD_MD_FLHANDLE (0x0000000000080000LL) /* file handle */
+#define OBD_MD_FLCKSUM (0x0000000000100000LL) /* bulk data checksum */
+#define OBD_MD_FLQOS (0x0000000000200000LL) /* quality of service stats */
+#define OBD_MD_FLOSCOPQ (0x0000000000400000LL) /* osc opaque data */
+#define OBD_MD_FLCOOKIE (0x0000000000800000LL) /* log cancellation cookie */
+#define OBD_MD_FLGROUP (0x0000000001000000LL) /* group */
+#define OBD_MD_FLIFID (0x0000000002000000LL) /* ->ost write inline fid */
+#define OBD_MD_FLEPOCH (0x0000000004000000LL) /* ->ost write easize is epoch */
+#define OBD_MD_FLGRANT (0x0000000008000000LL) /* ost preallocation space grant */
+#define OBD_MD_MDS (0x0000000010000000LL) /* where an inode lives on */
+#define OBD_MD_FLDIREA (0x0000000020000000LL) /* dir's extended attribute data */
+#define OBD_MD_REINT (0x0000000040000000LL) /* reintegrate oa */
+#define OBD_MD_FID (0x0000000080000000LL) /* reintegrate oa */
#define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME | \
OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | \
(struct lov_stripe_md **) &mea);
}
- /* MDS is supposed to return correct fid always. */
- LASSERT(id_fid(&body->id1) != 0);
- id_assign_fid(&lli->lli_id, &body->id1);
+ if (body->valid & OBD_MD_FID)
+ id_assign_fid(&lli->lli_id, &body->id1);
if (body->valid & OBD_MD_FLID)
id_ino(&lli->lli_id) = id_ino(&body->id1);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
inode->i_dev = (kdev_t)id_group(&lli->lli_id);
#endif
+ LASSERT(id_fid(&lli->lli_id) != 0);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
int rc;
rc = md_getattr_lock(exp, idp, filename, strlen(filename) + 1,
- 0, 0, &request);
+ OBD_MD_FID, 0, &request);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_lock failed on %s: rc %d\n",
filename, rc);
it->d.lustre.it_lock_mode = 0;
}
+ LASSERT((body->valid & OBD_MD_FID) != 0);
+
nid = body->id1;
it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE;
- rc = md_intent_lock(lmv->tgts[id_group(&nid)].ltd_exp, &nid,
- NULL, 0, lmm, lmmsize, NULL, it, flags,
- &req, cb_blocking);
+ rc = md_intent_lock(lmv->tgts[id_group(&nid)].ltd_exp, &nid, NULL,
+ 0, lmm, lmmsize, NULL, it, flags, &req, cb_blocking);
/*
* llite needs LOOKUP lock to track dentry revocation in order
memcpy(&it->d.lustre.it_lock_handle, &plock,
sizeof(plock));
it->d.lustre.it_lock_mode = pmode;
-
} else if (pmode)
ldlm_lock_decref(&plock, pmode);
RETURN(rc);
}
+ /*
+ * nothing is found, do not access body->id1 as it is zero and thus
+ * pointless.
+ */
+ if (it->d.lustre.it_disposition & DISP_LOOKUP_NEG)
+ RETURN(0);
+
/* caller may use attrs MDS returns on IT_OPEN lock request so, we have
* to update them for splitted dir */
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
-
+ LASSERT((body->valid & OBD_MD_FID) != 0);
+
cid = &body->id1;
obj = lmv_grab_obj(obd, cid);
if (!obj && (mea = lmv_splitted_dir_body(*reqp, 1))) {
}
/* the same about fid returning. */
- rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpid, name,
- len, lmm, lmmsize, cid, it, flags,
- reqp, cb_blocking);
+ rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpid, name, len, lmm,
+ lmmsize, cid, it, flags, reqp, cb_blocking);
if (rc < 0)
RETURN(rc);
if (rc < 0)
RETURN(rc);
+ /*
+ * nothing is found, do not access body->id1 as it is zero and thus
+ * pointless.
+ */
+ if (it->d.lustre.it_disposition & DISP_LOOKUP_NEG)
+ RETURN(0);
+
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
-
+ LASSERT((body->valid & OBD_MD_FID) != 0);
+
cid = &body->id1;
obj2 = lmv_grab_obj(obd, cid);
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
+ LASSERT((body->valid & OBD_MD_FID) != 0);
obj = lmv_grab_obj(obd, &body->id1);
LASSERT(obj != NULL);
/* wow! this is splitted dir, we'd like to handle it */
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
+ LASSERT((body->valid & OBD_MD_FID) != 0);
obj = lmv_grab_obj(obd, &body->id1);
if (!obj) {
CDEBUG(D_OTHER, "getattr_lock for %*s on "DLID4" -> "DLID4"\n",
namelen, filename, OLID4(id), OLID4(&rid));
- rc = md_getattr_lock(lmv->tgts[id_group(&rid)].ltd_exp,
- &rid, filename, namelen, valid,
+ rc = md_getattr_lock(lmv->tgts[id_group(&rid)].ltd_exp, &rid,
+ filename, namelen, (valid | OBD_MD_FID),
ea_size, request);
if (rc == 0) {
/*
*/
body = lustre_msg_buf((*request)->rq_repmsg, 0, sizeof(*body));
LASSERT(body != NULL);
+ LASSERT((body->valid & OBD_MD_FID) != 0);
+
if (body->valid & OBD_MD_MDS) {
struct ptlrpc_request *req = NULL;
body = lustre_msg_buf((*request)->rq_repmsg, 0,
sizeof(*body));
LASSERT(body != NULL);
+ LASSERT((body->valid & OBD_MD_FID) != 0);
LASSERT(id_group(&body->id1) == id_group(&data->id1));
}
}
mdc_id2mdc_data(op_data, pid, cid, name, len, 0);
+ if (name != NULL)
+ op_data->valid |= OBD_MD_FID;
+
rc = mdc_enqueue(exp, LDLM_IBITS, it, it_to_lock_mode(it),
op_data, &lockh, lmm, lmmsize,
ldlm_completion_ast, cb_blocking, NULL);
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+ body->valid |= OBD_MD_FID;
+
memcpy(&body->id1, &mds->mds_rootid, sizeof(body->id1));
/*
LASSERT(body != NULL); /* caller prepped reply */
if (dentry->d_flags & DCACHE_CROSS_REF) {
- mds_pack_dentry2body(obd, body, dentry);
+ mds_pack_dentry2body(obd, body, dentry,
+ (reqbody->valid & OBD_MD_FID) ? 1 : 0);
CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
OLID4(&body->id1));
RETURN(0);
}
- mds_pack_inode2body(obd, body, inode);
+ mds_pack_inode2body(obd, body, inode,
+ (reqbody->valid & OBD_MD_FID) ? 1 : 0);
if ((S_ISREG(inode->i_mode) && (reqbody->valid & OBD_MD_FLEASIZE)) ||
(S_ISDIR(inode->i_mode) && (reqbody->valid & OBD_MD_FLDIREA))) {
} else {
/* just any file to grab fsync method - "file" arg unused */
struct file *file = mds->mds_rcvd_filp;
+ struct mds_body *rep_body;
struct dentry *de;
de = mds_id2dentry(obd, &body->id1, NULL);
if (rc)
GOTO(out, rc);
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(obd, body, de->d_inode);
+ rep_body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_body));
+ mds_pack_inode2body(obd, rep_body, de->d_inode,
+ (body->valid & OBD_MD_FID) ? 1 : 0);
l_dput(de);
}
obdo_from_inode(&repbody->oa, new->d_inode, FILTER_VALID_FLAGS);
repbody->oa.o_id = new->d_inode->i_ino;
repbody->oa.o_generation = new->d_inode->i_generation;
- repbody->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER;
+ repbody->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FID;
if ((body->oa.o_flags & OBD_FL_RECREATE_OBJS) ||
lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
inode = dentry->d_inode;
LASSERT(dentry->d_inode);
- rc = mds_pack_inode2id(obd, &mds->mds_rootid, inode);
+ rc = mds_pack_inode2id(obd, &mds->mds_rootid, inode, 1);
if (rc < 0) {
if (rc != -ENODATA)
GOTO(out_dentry, rc);
struct mds_body *, struct inode *, int lock);
int mds_pack_inode2id(struct obd_device *, struct lustre_id *,
- struct inode *);
+ struct inode *, int);
void mds_pack_inode2body(struct obd_device *, struct mds_body *,
- struct inode *);
+ struct inode *, int);
void mds_pack_dentry2id(struct obd_device *, struct lustre_id *,
- struct dentry *);
+ struct dentry *, int);
void mds_pack_dentry2body(struct obd_device *, struct mds_body *b,
- struct dentry *);
+ struct dentry *, int);
#endif
/* mds/mds_lmv.c */
void mds_pack_dentry2id(struct obd_device *obd,
struct lustre_id *id,
- struct dentry *dentry)
+ struct dentry *dentry,
+ int fid)
{
id_ino(id) = dentry->d_inum;
id_gen(id) = dentry->d_generation;
- id_fid(id) = dentry->d_fid;
- id_group(id) = dentry->d_mdsnum;
+
+ if (fid) {
+ id_fid(id) = dentry->d_fid;
+ id_group(id) = dentry->d_mdsnum;
+ }
}
void mds_pack_dentry2body(struct obd_device *obd,
struct mds_body *b,
- struct dentry *dentry)
+ struct dentry *dentry,
+ int fid)
{
b->valid |= OBD_MD_FLID | OBD_MD_FLGENER |
OBD_MD_MDS;
- mds_pack_dentry2id(obd, &b->id1, dentry);
+ if (fid)
+ b->valid |= OBD_MD_FID;
+
+ mds_pack_dentry2id(obd, &b->id1, dentry, fid);
}
int mds_pack_inode2id(struct obd_device *obd,
struct lustre_id *id,
- struct inode *inode)
+ struct inode *inode,
+ int fid)
{
int rc = 0;
ENTRY;
-
- /* we have to avoid deadlock. */
- if (!down_trylock(&inode->i_sem)) {
- rc = mds_read_inode_sid(obd, inode, id);
- up(&inode->i_sem);
- } else {
- rc = mds_read_inode_sid(obd, inode, id);
+
+ if (fid) {
+ /* we have to avoid deadlock. */
+ if (!down_trylock(&inode->i_sem)) {
+ rc = mds_read_inode_sid(obd, inode, id);
+ up(&inode->i_sem);
+ } else {
+ rc = mds_read_inode_sid(obd, inode, id);
+ }
}
if (rc == 0) {
/* Note that we can copy all of the fields, just some will not be "valid" */
void mds_pack_inode2body(struct obd_device *obd, struct mds_body *b,
- struct inode *inode)
+ struct inode *inode, int fid)
{
b->valid |= OBD_MD_FLID | OBD_MD_FLCTIME | OBD_MD_FLUID |
OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLTYPE |
} else {
b->nlink = inode->i_nlink;
}
- mds_pack_inode2id(obd, &b->id1, inode);
+
+ if (fid)
+ b->valid |= OBD_MD_FID;
+
+ mds_pack_inode2id(obd, &b->id1, inode, fid);
}
/* unpacking */
GOTO(out_dput, 0);
/* get lock (write for O_CREAT, read otherwise) */
- mds_pack_inode2body(obd, body, dchild->d_inode);
+ mds_pack_inode2body(obd, body, dchild->d_inode, 1);
if (S_ISREG(dchild->d_inode->i_mode)) {
rc = mds_pack_md(obd, req->rq_repmsg, 2, body,
dchild->d_inode, 1);
if (dchild->d_inode != NULL) {
up(&pending_dir->i_sem);
mds_inode_set_orphan(dchild->d_inode);
- mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
+ mds_pack_inode2body(req2obd(req), body,
+ dchild->d_inode, 1);
+
intent_set_disposition(rep, DISP_LOOKUP_EXECD);
intent_set_disposition(rep, DISP_LOOKUP_POS);
CWARN("Orphan %s found and opened in PENDING directory\n",
if (IS_ERR(dchild))
RETURN(PTR_ERR(dchild));
- mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
+ mds_pack_inode2body(req2obd(req), body,
+ dchild->d_inode, 1);
+
intent_set_disposition(rep, DISP_LOOKUP_EXECD);
intent_set_disposition(rep, DISP_LOOKUP_POS);
ldlm_policy_data_t policy;
int flags = 0;
- mds_pack_dentry2body(obd, body, dchild);
+ mds_pack_dentry2body(obd, body, dchild, 1);
intent_set_disposition(rep, DISP_LOOKUP_POS);
CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
acc_mode = 0; /* Don't check for permissions */
}
- mds_pack_inode2body(obd, body, dchild->d_inode);
+ mds_pack_inode2body(obd, body, dchild->d_inode, 1);
LASSERTF(!mds_inode_is_orphan(dchild->d_inode),
"dchild %*s (%p) inode %p\n", dchild->d_name.len,
/* child i_alloc_sem protects orphan_dec_test && is_orphan race */
DOWN_WRITE_I_ALLOC_SEM(inode); /* mds_mfd_close drops this */
if (mds_inode_is_orphan(inode) && mds_orphan_open_count(inode) == 1) {
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- LASSERT(body != NULL);
+ struct mds_body *rep_body;
- mds_pack_inode2body(obd, body, inode);
- mds_pack_md(obd, req->rq_repmsg, 1, body,
+ rep_body = lustre_msg_buf(req->rq_repmsg, 0,
+ sizeof (*rep_body));
+ LASSERT(rep_body != NULL);
+
+ mds_pack_inode2body(obd, rep_body, inode,
+ (body->valid & OBD_MD_FID) ? 1 : 0);
+
+ mds_pack_md(obd, req->rq_repmsg, 1, rep_body,
inode, MDS_PACK_MD_LOCK);
}
spin_lock(&med->med_open_lock);
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(req2obd(req), body, de->d_inode);
+ mds_pack_inode2body(req2obd(req), body, de->d_inode, 1);
/* Don't return OST-specific attributes if we didn't just set them */
if (rec->ur_iattr.ia_valid & ATTR_SIZE)
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_inode2body(obd, body, inode);
+ mds_pack_inode2body(obd, body, inode, 1);
/* Don't return OST-specific attributes if we didn't just set them */
if (rec->ur_iattr.ia_valid & ATTR_SIZE)
if ((child->d_flags & DCACHE_CROSS_REF)) {
LASSERTF(child->d_inode == NULL, "BUG 3869\n");
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_dentry2body(req2obd(req), body, child);
+ mds_pack_dentry2body(req2obd(req), body, child, 1);
} else if (child->d_inode == NULL) {
DEBUG_REQ(D_ERROR, req, "parent "DLID4" name %s mode %o",
OLID4(rec->ur_id1), rec->ur_name, rec->ur_mode);
LASSERTF(child->d_inode != NULL, "BUG 3869\n");
} else {
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(req2obd(req), body, child->d_inode);
+ mds_pack_inode2body(req2obd(req), body, child->d_inode, 1);
}
l_dput(parent);
l_dput(child);
/* fill reply */
body = lustre_msg_buf(req->rq_repmsg,
0, sizeof(*body));
- body->valid |= OBD_MD_FLID | OBD_MD_MDS;
+ body->valid |= OBD_MD_FLID | OBD_MD_MDS | OBD_MD_FID;
obdo2id(&body->id1, oa);
obdo_free(oa);
MD_COUNTER_INCREMENT(obd, create);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(obd, body, inode);
+ mds_pack_inode2body(obd, body, inode, 1);
}
EXIT;
RETURN(-ENOMEM);
memset(op_data, 0, sizeof(*op_data));
- mds_pack_dentry2id(obd, &op_data->id1, dchild);
+ mds_pack_dentry2id(obd, &op_data->id1, dchild, 1);
op_data->create_mode = rec->ur_mode;
DEBUG_REQ(D_INODE, req, "unlink %*s (remote inode "DLID4")",
down(&mds->mds_pending_dir->d_inode->i_sem);
cleanup_phase = 5; /* up(&pending_dir->i_sem) */
} else if (S_ISREG(child_inode->i_mode)) {
- mds_pack_inode2body(obd, body, child_inode);
+ mds_pack_inode2body(obd, body, child_inode, 0);
mds_pack_md(obd, req->rq_repmsg, offset + 1,
body, child_inode, MDS_PACK_MD_LOCK);
}
RETURN(-ENOMEM);
}
memset(op_data, 0, sizeof(*op_data));
- mds_pack_dentry2id(obd, &op_data->id1, dentry);
+ mds_pack_dentry2id(obd, &op_data->id1, dentry, 1);
it.it_op = IT_UNLINK;
rc = md_enqueue(mds->mds_md_exp, LDLM_IBITS, &it, LCK_EX,
if (de_old->d_flags & DCACHE_CROSS_REF) {
LASSERT(de_old->d_inode == NULL);
CDEBUG(D_OTHER, "request to move remote name\n");
- mds_pack_dentry2id(obd, &op_data->id1, de_old);
+ mds_pack_dentry2id(obd, &op_data->id1, de_old, 1);
} else if (de_old->d_inode == NULL) {
/* oh, source doesn't exist */
OBD_FREE(op_data, sizeof(*op_data));
}
+ /* check if inodes point to each other. */
+ if (!(de_old->d_flags & DCACHE_CROSS_REF) &&
+ !(de_new->d_flags & DCACHE_CROSS_REF) &&
+ old_inode == new_inode)
+ GOTO(cleanup, rc = 0);
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
/*
* check if we are moving old entry into its child. 2.6 does not check
GOTO(cleanup, rc = -EINVAL);
#endif
- /* check if inodes point to each other. */
- if (!(de_old->d_flags & DCACHE_CROSS_REF) &&
- !(de_new->d_flags & DCACHE_CROSS_REF) &&
- old_inode == new_inode)
- GOTO(cleanup, rc = 0);
-
/*
* if we are about to remove the target at first, pass the EA of that
* inode to client to perform and cleanup on OST.
down(&mds->mds_pending_dir->d_inode->i_sem);
cleanup_phase = 3; /* up(&pending_dir->i_sem) */
} else if (S_ISREG(new_inode->i_mode)) {
- mds_pack_inode2body(obd, body, new_inode);
+ mds_pack_inode2body(obd, body, new_inode, 0);
mds_pack_md(obd, req->rq_repmsg, 1, body,
new_inode, MDS_PACK_MD_LOCK);
}
if (de_old->d_flags & DCACHE_CROSS_REF) {
struct lustre_id old_id;
- mds_pack_dentry2id(obd, &old_id, de_old);
-
+ mds_pack_dentry2id(obd, &old_id, de_old, 1);
+
rc = mds_add_local_dentry(rec, offset, req, &old_id,
de_tgtdir, de_new, 1);
if (rc)