req->rq_export->exp_mds_data.med_mcd; \
if (mcd->mcd_last_xid == req->rq_xid) { \
reconstruct; \
- RETURN(0); \
+ RETURN(req->rq_repmsg->status); \
} \
DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")", \
mcd->mcd_last_xid); \
(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 (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))
LASSERT(body != NULL); /* caller prepped reply */
if (dentry->d_flags & DCACHE_CROSS_REF) {
- mds_pack_dentry2body(obd, body, dentry, 1);
+ mds_pack_dentry2body(obd, body, dentry);
CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
OLID4(&body->id1));
RETURN(0);
}
- mds_pack_inode2body(obd, body, inode, 1);
+ mds_pack_inode2body(obd, body, inode);
if ((S_ISREG(inode->i_mode) && (reqbody->valid & OBD_MD_FLEASIZE)) ||
(S_ISDIR(inode->i_mode) && (reqbody->valid & OBD_MD_FLDIREA))) {
GOTO(out, rc);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(obd, body, de->d_inode, 0);
+ mds_pack_inode2body(obd, body, de->d_inode);
l_dput(de);
}
inode = dentry->d_inode;
LASSERT(dentry->d_inode);
- rc = mds_pack_inode2id(obd, &mds->mds_rootid, inode, 1);
+ rc = mds_pack_inode2id(obd, &mds->mds_rootid, inode);
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 *, int);
+ struct inode *);
void mds_pack_inode2body(struct obd_device *, struct mds_body *,
- struct inode *, int);
+ struct inode *);
void mds_pack_dentry2id(struct obd_device *, struct lustre_id *,
- struct dentry *, int);
+ struct dentry *);
void mds_pack_dentry2body(struct obd_device *, struct mds_body *b,
- struct dentry *, int);
+ struct dentry *);
#endif
/* mds/mds_lmv.c */
void mds_pack_dentry2id(struct obd_device *obd,
struct lustre_id *id,
- struct dentry *dentry,
- int read_fid)
+ struct dentry *dentry)
{
id_ino(id) = dentry->d_inum;
id_gen(id) = dentry->d_generation;
-
- if (read_fid) {
- id_fid(id) = dentry->d_fid;
- id_group(id) = dentry->d_mdsnum;
- }
+ 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,
- int read_fid)
+ struct dentry *dentry)
{
b->valid |= OBD_MD_FLID | OBD_MD_FLGENER |
OBD_MD_MDS;
- mds_pack_dentry2id(obd, &b->id1, dentry,
- read_fid);
+ mds_pack_dentry2id(obd, &b->id1, dentry);
}
int mds_pack_inode2id(struct obd_device *obd,
struct lustre_id *id,
- struct inode *inode,
- int read_fid)
+ struct inode *inode)
{
int rc = 0;
ENTRY;
- if (read_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);
- }
+ /* 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) {
id_ino(id) = inode->i_ino;
id_gen(id) = inode->i_generation;
/* 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, int read_fid)
+ struct inode *inode)
{
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, read_fid);
+ mds_pack_inode2id(obd, &b->id1, inode);
}
/* unpacking */
GOTO(out_dput, 0);
/* get lock (write for O_CREAT, read otherwise) */
- mds_pack_inode2body(obd, body, dchild->d_inode, 0);
+ mds_pack_inode2body(obd, body, dchild->d_inode);
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, 0);
+ mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
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, 0);
+ mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
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, 1);
+ mds_pack_dentry2body(obd, body, dchild);
intent_set_disposition(rep, DISP_LOOKUP_POS);
CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
}
acc_mode = 0; /* Don't check for permissions */
-
- /*
- * we do not read fid from EA here, because it is already
- * updated and thus we avoid not needed IO, locking, etc.
- */
- mds_pack_inode2body(obd, body, dchild->d_inode, 0);
- } else {
- mds_pack_inode2body(obd, body, dchild->d_inode, 1);
}
+ mds_pack_inode2body(obd, body, dchild->d_inode);
+
LASSERTF(!mds_inode_is_orphan(dchild->d_inode),
"dchild %*s (%p) inode %p\n", dchild->d_name.len,
dchild->d_name.name, dchild, dchild->d_inode);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
LASSERT(body != NULL);
- mds_pack_inode2body(obd, body, inode, 0);
- mds_pack_md(obd, req->rq_repmsg, 1, body, inode, MDS_PACK_MD_LOCK);
+ mds_pack_inode2body(obd, body, inode);
+ mds_pack_md(obd, req->rq_repmsg, 1, body,
+ inode, MDS_PACK_MD_LOCK);
}
spin_lock(&med->med_open_lock);
list_del(&mfd->mfd_list);
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(req2obd(req), body, de->d_inode, 0);
+ mds_pack_inode2body(req2obd(req), body, de->d_inode);
/* 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, 0);
- body->id1 = *rec->ur_id1;
+ mds_pack_inode2body(obd, body, inode);
/* 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, 1);
+ mds_pack_dentry2body(req2obd(req), body, child);
} 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, 1);
+ mds_pack_inode2body(req2obd(req), body, child->d_inode);
}
l_dput(parent);
l_dput(child);
MD_COUNTER_INCREMENT(obd, create);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2body(obd, body, inode, 1);
+ mds_pack_inode2body(obd, body, inode);
}
EXIT;
RETURN(-ENOMEM);
memset(op_data, 0, sizeof(*op_data));
- mds_pack_dentry2id(obd, &op_data->id1, dchild, 1);
+ mds_pack_dentry2id(obd, &op_data->id1, dchild);
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, 0);
+ mds_pack_inode2body(obd, body, child_inode);
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, 1);
+ mds_pack_dentry2id(obd, &op_data->id1, dentry);
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, 1);
+ mds_pack_dentry2id(obd, &op_data->id1, de_old);
} else if (de_old->d_inode == NULL) {
/* oh, source doesn't exist */
OBD_FREE(op_data, sizeof(*op_data));
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, 0);
+ mds_pack_inode2body(obd, body, new_inode);
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, 1);
+ mds_pack_dentry2id(obd, &old_id, de_old);
rc = mds_add_local_dentry(rec, offset, req, &old_id,
de_tgtdir, de_new, 1);