struct dentry *pending_child;
char fidname[LL_FID_NAMELEN];
int fidlen = 0, rc;
- unsigned mode;
ENTRY;
LASSERT(!mds_inode_is_orphan(dchild->d_inode));
GOTO(out_dput, rc = 0);
}
- /* link() is semanticaly-wrong for S_IFDIR, so we set S_IFREG
- * for linking and return real mode back then -bzzz */
- mode = dchild->d_inode->i_mode;
- dchild->d_inode->i_mode = S_IFREG;
- rc = vfs_link(dchild, pending_dir, pending_child);
+ *handle = fsfilt_start(obd, pending_dir, FSFILT_OP_RENAME, NULL);
+ if (IS_ERR(*handle))
+ GOTO(out_dput, rc = PTR_ERR(*handle));
+
+ lock_kernel();
+ rc = vfs_rename(dparent->d_inode, dchild, pending_dir, pending_child);
+ unlock_kernel();
if (rc)
- CERROR("error linking orphan %s to PENDING: rc = %d\n",
- rec->ur_name, rc);
+ CERROR("error renaming orphan %lu/%s to PENDING: rc = %d\n",
+ dparent->d_inode->i_ino, rec->ur_name, rc);
else
mds_inode_set_orphan(dchild->d_inode);
-
- /* return mode and correct i_nlink if inode is directory */
- LASSERT(dchild->d_inode->i_nlink == 1);
- dchild->d_inode->i_mode = mode;
- if ((mode & S_IFMT) == S_IFDIR) {
- dchild->d_inode->i_nlink++;
- pending_dir->i_nlink++;
- }
- mark_inode_dirty(dchild->d_inode);
-
out_dput:
dput(pending_child);
out_lock:
int mds_cleanup_orphans(struct obd_device *obd)
{
struct mds_obd *mds = &obd->u.mds;
- struct lvfs_run_ctxt saved;
+ struct obd_run_ctxt saved;
struct file *file;
struct dentry *dchild, *dentry;
struct vfsmount *mnt;
int rc = 0, item = 0, namlen;
ENTRY;
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_ctxt, NULL);
dentry = dget(mds->mds_pending_dir);
if (IS_ERR(dentry))
GOTO(err_pop, rc = PTR_ERR(dentry));
OBD_FREE(dirent, sizeof(*dirent));
}
err_pop:
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ pop_ctxt(&saved, &obd->obd_ctxt, NULL);
if (rc == 0)
rc = item;
RETURN(rc);