trying to bypass that step (and run into troubles).
if (dentry->d_name.len > EXT2_NAME_LEN)
RETURN(ERR_PTR(-ENAMETOOLONG));
- if (it->it_op == IT_RENAME2) {
- /* Set below to be the old dentry from the IT_RENAME intent */
- inode = ((struct dentry *)(it->it_data))->d_inode;
- LASSERT(inode);
- }
-
err = ll_lock(dir, dentry, it, &lockh);
if (err < 0)
RETURN(ERR_PTR(err));
if (it->it_status && it->it_status != -EEXIST)
GOTO(neg_req, NULL);
} else if (it->it_op == IT_RENAME2) {
- /* FIXME: make old_de negative, and drop
- * new_de->d_inode if needed.
- */
+ struct mds_body *body =
+ lustre_msg_buf(request->rq_repmsg, offset);
it->it_data = NULL;
- GOTO(out_req, NULL);
+ if (body->valid == 0)
+ GOTO(neg_req, NULL);
+ GOTO(iget, NULL);
}
/* Do a getattr now that we have the lock */
/* No rpc's happen during iget4, -ENOMEM's are possible */
inode = iget4(dir->i_sb, ino, ll_find_inode, &md);
- out_req:
LASSERT(!IS_ERR(inode));
if (!inode) {
ptlrpc_free_req(request);
struct inode * new_inode = new_dentry->d_inode;
struct page * dir_page = NULL;
struct ext2_dir_entry_2 * dir_de = NULL;
- struct page * old_page;
struct ext2_dir_entry_2 * old_de;
+ struct page * old_page;
int err = -ENOENT;
- if (new_dentry->d_it && new_dentry->d_it->it_disposition)
+ if (new_dentry->d_it && new_dentry->d_it->it_disposition) {
+ if (new_inode) {
+ new_inode->i_ctime = CURRENT_TIME;
+ new_inode->i_nlink--;
+ dput(new_dentry);
+ }
GOTO(out, err = new_dentry->d_it->it_status);
+ }
err = ll_mdc_rename(old_dir, new_dir, old_dentry, new_dentry);
if (err)
mds_rename_pack(req, 2, old_de->d_parent->d_inode, dir,
old_de->d_name.name, old_de->d_name.len,
de->d_name.name, de->d_name.len);
- req->rq_replen = lustre_msg_size(1, repsize);
+ req->rq_replen = lustre_msg_size(3, repsize);
} else if (it->it_op == IT_UNLINK || it->it_op == IT_RMDIR) {
size[2] = sizeof(struct mds_rec_unlink);
size[3] = de->d_name.len + 1;
struct mds_body *mds_rep;
struct ldlm_reply *rep;
__u64 new_resid[3] = {0, 0, 0}, old_res;
- int bufcount = -1, rc, size[3] = {sizeof(struct ldlm_reply),
+ int rc, size[3] = {sizeof(struct ldlm_reply),
sizeof(struct mds_body),
mds->mds_max_mdsize};
LDLM_DEBUG(lock, "intent policy, opc: %s",
ldlm_it2str(it->opc));
- /* prepare reply */
- switch((long)it->opc) {
- case IT_GETATTR:
- /* Note that in the negative case you may be returning
- * a file and its obdo */
- case IT_CREAT:
- case IT_CREAT|IT_OPEN:
- case IT_LINK:
- case IT_LOOKUP:
- case IT_MKDIR:
- case IT_MKNOD:
- case IT_OPEN:
- case IT_READLINK:
- case IT_RENAME:
- case IT_RMDIR:
- case IT_SETATTR:
- case IT_SYMLINK:
- case IT_UNLINK:
- bufcount = 3;
- break;
- case IT_RENAME2:
- bufcount = 1;
- break;
- default:
- LBUG();
- }
-
- rc = lustre_pack_msg(bufcount, size, NULL, &req->rq_replen,
+ rc = lustre_pack_msg(3, size, NULL, &req->rq_replen,
&req->rq_repmsg);
if (rc) {
rc = req->rq_status = -ENOMEM;
rec->ur_tgtlen - 1, rec->ur_tgt, PTR_ERR(de_new));
GOTO(out_rename_deold, rc = -ENOENT);
}
+
+ /* in intent case ship back attributes to client */
+ if (offset) {
+ struct mds_body *body = lustre_msg_buf(req->rq_repmsg, 1);
+ struct inode *inode = de_new->d_inode;
+
+ if (!inode) {
+ body->valid = 0;
+ } else {
+ mds_pack_inode2fid(&body->fid1, inode);
+ mds_pack_inode2body(body, inode);
+ if (S_ISREG(inode->i_mode)) {
+ struct lov_mds_md *md;
+
+ md = lustre_msg_buf(req->rq_repmsg, 2);
+ md->lmd_easize = mds->mds_max_mdsize;
+ if ((rc = mds_fs_get_md(mds, inode, md)) < 0) {
+ CDEBUG(D_INFO,"No md for %ld: rc %d\n",
+ inode->i_ino, rc);
+ memset(md, 0, md->lmd_easize);
+ }
+ }
+ }
+ }
OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_RENAME_WRITE,
de_srcdir->d_inode->i_sb->s_dev);