- struct inode *pending_dir = mds->mds_pending_dir->d_inode;
- struct dentry *pending_child;
- char fidname[LL_FID_NAMELEN];
- int fidlen = 0, rc;
- ENTRY;
-
- LASSERT(!mds_inode_is_orphan(dchild->d_inode));
-
- down(&pending_dir->i_sem);
- fidlen = ll_fid2str(fidname, dchild->d_inode->i_ino,
- dchild->d_inode->i_generation);
-
- CWARN("pending destroy of %dx open file %s = %s\n",
- mds_open_orphan_count(dchild->d_inode),
- rec->ur_name, fidname);
-
- pending_child = lookup_one_len(fidname, mds->mds_pending_dir, fidlen);
- if (IS_ERR(pending_child))
- GOTO(out_lock, rc = PTR_ERR(pending_child));
-
- if (pending_child->d_inode != NULL) {
- CERROR("re-destroying orphan file %s?\n", rec->ur_name);
- LASSERT(pending_child->d_inode == dchild->d_inode);
- GOTO(out_dput, rc = 0);
- }
-
- *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 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);
-out_dput:
- dput(pending_child);
-out_lock:
- up(&pending_dir->i_sem);
- RETURN(rc);
-}
-
-static int mds_osc_destroy_orphan(struct mds_obd *mds,
- struct ptlrpc_request *request)
-{
- struct mds_body *body;
- struct lov_mds_md *lmm = NULL;