1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2002, 2003 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * derived in small part from linux/fs/ext2/namei.c
23 * Copyright (C) 1991, 1992 Linus Torvalds
25 * Big-endian to little-endian byte-swapping/bitmaps by
26 * David S. Miller (davem@caip.rutgers.edu), 1995
27 * Directory entry file type support and forward compatibility hooks
28 * for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
32 #include <linux/sched.h>
34 #include <linux/smp_lock.h>
35 #include <linux/quotaops.h>
36 #include <linux/highmem.h>
37 #include <linux/pagemap.h>
39 #define DEBUG_SUBSYSTEM S_LLITE
41 #include <linux/obd_support.h>
42 #include <linux/lustre_lite.h>
43 #include <linux/lustre_dlm.h>
44 #include <linux/lustre_version.h>
45 #include "llite_internal.h"
49 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
50 static int ll_test_inode(struct inode *inode, unsigned long ino, void *opaque)
52 static int ll_test_inode(struct inode *inode, void *opaque)
55 static int last_ino, last_gen, last_count;
56 struct lustre_md *md = opaque;
58 if (!(md->body->valid & (OBD_MD_FLGENER | OBD_MD_FLID))) {
59 CERROR("MDS body missing inum or generation\n");
63 if (last_ino == md->body->ino && last_gen == md->body->generation &&
68 CDEBUG(D_VFSTRACE, "compared %u/%u %u times\n",
69 last_ino, last_gen, last_count);
71 last_ino = md->body->ino;
72 last_gen = md->body->generation;
74 "comparing inode %p ino %lu/%u/%u to body %u/%u/%u\n",
75 inode, inode->i_ino, inode->i_generation,
76 ll_i2info(inode)->lli_mds,
77 md->body->ino, md->body->generation,
81 if (inode->i_generation != md->body->generation)
84 if (ll_i2info(inode)->lli_mds != md->body->mds)
87 /* Apply the attributes in 'opaque' to this inode */
88 ll_update_inode(inode, md);
92 extern struct dentry_operations ll_d_ops;
94 int ll_unlock(__u32 mode, struct lustre_handle *lockh)
98 ldlm_lock_decref(lockh, mode);
103 /* Get an inode by inode number (already instantiated by the intent lookup).
104 * Returns inode or NULL
106 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
107 int ll_set_inode(struct inode *inode, void *opaque)
109 ll_read_inode2(inode, opaque);
113 struct inode *ll_iget(struct super_block *sb, ino_t hash,
114 struct lustre_md *md)
119 inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md);
122 if (inode->i_state & I_NEW)
123 unlock_new_inode(inode);
124 CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", inode->i_ino,
125 inode->i_generation, inode);
131 struct inode *ll_iget(struct super_block *sb, ino_t hash,
132 struct lustre_md *md)
136 inode = iget4(sb, hash, ll_test_inode, md);
138 CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", inode->i_ino,
139 inode->i_generation, inode);
144 int ll_mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
145 void *data, int flag)
148 struct lustre_handle lockh;
152 case LDLM_CB_BLOCKING:
153 ldlm_lock2handle(lock, &lockh);
154 rc = ldlm_cli_cancel(&lockh);
156 CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc);
160 case LDLM_CB_CANCELING: {
161 struct inode *inode = ll_inode_from_lock(lock);
162 __u64 bits = lock->l_policy_data.l_inodebits.bits;
164 /* For lookup locks: Invalidate all dentries associated with
165 this inode, for UPDATE locks - invalidate directory pages */
169 if (bits & MDS_INODELOCK_UPDATE)
170 clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK,
171 &(ll_i2info(inode)->lli_flags));
174 if (lock->l_resource->lr_name.name[0] != inode->i_ino ||
175 lock->l_resource->lr_name.name[1] != inode->i_generation) {
176 LDLM_ERROR(lock, "data mismatch with ino %lu/%u",
177 inode->i_ino, inode->i_generation);
180 /* If lookup lock is cancelled, we just drop the dentry and
181 this will cause us to reget data from MDS when we'd want to
182 access this dentry/inode again. If this is lock on
183 other parts of inode that is cancelled, we do not need to do
184 much (but need to discard data from readdir, if any), since
185 abscence of lock will cause ll_revalidate_it (called from
186 stat() and similar functions) to renew the data anyway */
187 if (S_ISDIR(inode->i_mode) &&
188 (bits & MDS_INODELOCK_UPDATE)) {
189 CDEBUG(D_INODE, "invalidating inode %lu\n",
192 ll_invalidate_inode_pages(inode);
195 if (inode->i_sb->s_root &&
196 inode != inode->i_sb->s_root->d_inode &&
197 (bits & MDS_INODELOCK_LOOKUP))
198 ll_unhash_aliases(inode);
209 int ll_mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode,
210 int flags, void *opaque)
212 struct ldlm_res_id res_id =
213 { .name = {inode->i_ino, inode->i_generation} };
214 struct obd_device *obddev = class_conn2obd(conn);
217 RETURN(ldlm_cli_cancel_unused(obddev->obd_namespace, &res_id, flags,
222 void ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
223 struct inode *i2, const char *name, int namelen,
228 ll_i2uctxt(&data->ctxt, i1, i2);
229 ll_inode2fid(&data->fid1, i1);
231 /* it could be directory with mea */
232 data->mea1 = ll_i2info(i1)->lli_mea;
235 ll_inode2fid(&data->fid2, i2);
236 data->mea2 = ll_i2info(i2)->lli_mea;
240 data->namelen = namelen;
241 data->create_mode = mode;
242 data->mod_time = LTIME_S(CURRENT_TIME);
245 /* Search "inode"'s alias list for a dentry that has the same name and parent as
246 * de. If found, return it. If not found, return de. */
247 struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
249 struct list_head *tmp;
251 spin_lock(&dcache_lock);
252 list_for_each(tmp, &inode->i_dentry) {
253 struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
255 /* We are called here with 'de' already on the aliases list. */
261 if (dentry->d_parent != de->d_parent)
264 if (dentry->d_name.len != de->d_name.len)
267 if (memcmp(dentry->d_name.name, de->d_name.name,
268 de->d_name.len) != 0)
271 if (!list_empty(&dentry->d_lru))
272 list_del_init(&dentry->d_lru);
274 hlist_del_init(&dentry->d_hash);
275 __d_rehash(dentry, 0); /* avoid taking dcache_lock inside */
276 spin_unlock(&dcache_lock);
277 atomic_inc(&dentry->d_count);
279 dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
283 spin_unlock(&dcache_lock);
288 static int lookup_it_finish(struct ptlrpc_request *request, int offset,
289 struct lookup_intent *it, void *data)
291 struct it_cb_data *icbd = data;
292 struct dentry **de = icbd->icbd_childp;
293 struct inode *parent = icbd->icbd_parent;
294 struct ll_sb_info *sbi = ll_i2sbi(parent);
295 struct dentry *dentry = *de, *saved = *de;
296 struct inode *inode = NULL;
299 /* NB 1 request reference will be taken away by ll_intent_lock()
301 if (!it_disposition(it, DISP_LOOKUP_NEG)) {
304 rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
305 &inode, request, offset, dentry->d_sb);
309 CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
310 inode, inode->i_ino, inode->i_generation);
311 mdc_set_lock_data(&it->d.lustre.it_lock_handle, inode);
313 /* If this is a stat, get the authoritative file size */
314 if (it->it_op == IT_GETATTR && S_ISREG(inode->i_mode) &&
315 ll_i2info(inode)->lli_smd != NULL) {
316 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
320 LASSERT(lsm->lsm_object_id != 0);
322 /* bug 2334: drop MDS lock before acquiring OST lock */
323 ll_intent_drop_lock(it);
325 rc = ll_glimpse_size(inode, &lvb);
330 inode->i_size = lvb.lvb_size;
333 dentry = *de = ll_find_alias(inode, dentry);
338 dentry->d_op = &ll_d_ops;
341 if (dentry == saved) {
342 d_add(dentry, inode);
349 static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
350 struct lookup_intent *it, int flags)
352 struct dentry *save = dentry, *retval;
354 struct ll_uctxt ctxt;
355 struct it_cb_data icbd;
356 struct ptlrpc_request *req = NULL;
357 struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
361 if (dentry->d_name.len > EXT3_NAME_LEN)
362 RETURN(ERR_PTR(-ENAMETOOLONG));
364 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p),intent=%s\n",
365 dentry->d_name.name, parent->i_ino, parent->i_generation,
366 parent, LL_IT2STR(it));
368 if (d_mountpoint(dentry))
369 CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it));
371 ll_frob_intent(&it, &lookup_it);
373 icbd.icbd_childp = &dentry;
374 icbd.icbd_parent = parent;
375 ll_inode2fid(&pfid, parent);
376 ll_i2uctxt(&ctxt, parent, NULL);
378 rc = md_intent_lock(ll_i2mdcexp(parent), &ctxt, &pfid,
379 dentry->d_name.name, dentry->d_name.len, NULL, 0,
380 NULL, it, flags, &req, ll_mdc_blocking_ast);
382 GOTO(out, retval = ERR_PTR(rc));
384 rc = lookup_it_finish(req, 1, it, &icbd);
386 ll_intent_release(it);
387 GOTO(out, retval = ERR_PTR(rc));
390 ll_lookup_finish_locks(it, dentry);
393 GOTO(out, retval = NULL);
395 GOTO(out, retval = dentry);
398 ptlrpc_req_finished(req);
400 CDEBUG(D_INODE, "lookup 0x%p in %lu/%lu: %*s -> %lu/%lu\n",
402 (unsigned long) parent->i_ino,
403 (unsigned long) parent->i_generation,
404 dentry->d_name.len, dentry->d_name.name,
405 (unsigned long) dentry->d_inode->i_ino,
406 (unsigned long) dentry->d_inode->i_generation);
408 CDEBUG(D_INODE, "lookup 0x%p in %lu/%lu: %*s -> ??\n",
410 (unsigned long) parent->i_ino,
411 (unsigned long) parent->i_generation,
412 dentry->d_name.len, dentry->d_name.name);
416 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
417 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
418 struct nameidata *nd)
423 if (nd && nd->flags & LOOKUP_LAST && !(nd->flags & LOOKUP_LINK_NOTLAST))
424 de = ll_lookup_it(parent, dentry, &nd->intent, nd->flags);
426 de = ll_lookup_it(parent, dentry, NULL, 0);
432 /* We depend on "mode" being set with the proper file type/umask by now */
433 static struct inode *ll_create_node(struct inode *dir, const char *name,
434 int namelen, const void *data, int datalen,
435 int mode, __u64 extra,
436 struct lookup_intent *it)
438 struct inode *inode = NULL;
439 struct ptlrpc_request *request = NULL;
440 struct ll_sb_info *sbi = ll_i2sbi(dir);
444 LASSERT(it && it->d.lustre.it_disposition);
446 request = it->d.lustre.it_data;
447 rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
448 &inode, request, 1, dir->i_sb);
450 GOTO(out, inode = ERR_PTR(rc));
452 LASSERT(list_empty(&inode->i_dentry));
454 /* We asked for a lock on the directory, but were granted a
455 * lock on the inode. Since we finally have an inode pointer,
456 * stuff it in the lock. */
457 CDEBUG(D_DLMTRACE, "setting l_ast_data to inode %p (%lu/%u)\n",
458 inode, inode->i_ino, inode->i_generation);
459 mdc_set_lock_data(&it->d.lustre.it_lock_handle, inode);
462 ptlrpc_req_finished(request);
467 * By the time this is called, we already have created the directory cache
468 * entry for the new file, but it is so far negative - it has no inode.
470 * We defer creating the OBD object(s) until open, to keep the intent and
471 * non-intent code paths similar, and also because we do not have the MDS
472 * inode number before calling ll_create_node() (which is needed for LOV),
473 * so we would need to do yet another RPC to the MDS to store the LOV EA
474 * data on the MDS. If needed, we would pass the PACKED lmm as data and
475 * lmm_size in datalen (the MDS still has code which will handle that).
477 * If the create succeeds, we fill in the inode information
478 * with d_instantiate().
480 static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
481 struct lookup_intent *it)
484 struct ptlrpc_request *request = it->d.lustre.it_data;
488 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p),intent=%s\n",
489 dentry->d_name.name, dir->i_ino, dir->i_generation, dir,
492 rc = it_open_error(DISP_OPEN_CREATE, it);
496 mdc_store_inode_generation(request, 2, 1);
497 inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
498 NULL, 0, mode, 0, it);
500 RETURN(PTR_ERR(inode));
503 d_instantiate(dentry, inode);
507 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
508 static int ll_create_nd(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
510 return ll_create_it(dir, dentry, mode, &nd->intent);
514 static int ll_mknod_raw(struct nameidata *nd, int mode, dev_t rdev)
516 struct ptlrpc_request *request = NULL;
517 struct inode *dir = nd->dentry->d_inode;
518 const char *name = nd->last.name;
519 int len = nd->last.len;
520 struct ll_sb_info *sbi = ll_i2sbi(dir);
521 struct mdc_op_data op_data;
525 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
526 name, dir->i_ino, dir->i_generation, dir);
528 if (dir->i_nlink >= EXT3_LINK_MAX)
531 mode &= ~current->fs->umask;
533 switch (mode & S_IFMT) {
536 mode |= S_IFREG; /* for mode = 0 case, fallthrough */
541 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
542 err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
543 current->fsuid, current->fsgid,
545 ptlrpc_req_finished(request);
556 static int ll_mknod(struct inode *dir, struct dentry *child, int mode,
559 struct ptlrpc_request *request = NULL;
560 struct inode *inode = NULL;
561 const char *name = child->d_name.name;
562 int len = child->d_name.len;
563 struct ll_sb_info *sbi = ll_i2sbi(dir);
564 struct mdc_op_data op_data;
568 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
569 name, dir->i_ino, dir->i_generation, dir);
571 if (dir->i_nlink >= EXT3_LINK_MAX)
574 mode &= ~current->fs->umask;
576 switch (mode & S_IFMT) {
579 mode |= S_IFREG; /* for mode = 0 case, fallthrough */
584 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
585 err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
586 current->fsuid, current->fsgid,
588 err = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
589 &inode, request, 0, child->d_sb);
600 d_instantiate(child, inode);
602 ptlrpc_req_finished(request);
606 static int ll_symlink_raw(struct nameidata *nd, const char *tgt)
608 struct inode *dir = nd->dentry->d_inode;
609 const char *name = nd->last.name;
610 int len = nd->last.len;
611 struct ptlrpc_request *request = NULL;
612 struct ll_sb_info *sbi = ll_i2sbi(dir);
613 struct mdc_op_data op_data;
617 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p),target=%s\n",
618 name, dir->i_ino, dir->i_generation, dir, tgt);
620 if (dir->i_nlink >= EXT3_LINK_MAX)
623 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
624 err = md_create(sbi->ll_mdc_exp, &op_data,
625 tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
626 current->fsuid, current->fsgid, 0, &request);
627 ptlrpc_req_finished(request);
631 static int ll_link_raw(struct nameidata *srcnd, struct nameidata *tgtnd)
633 struct inode *src = srcnd->dentry->d_inode;
634 struct inode *dir = tgtnd->dentry->d_inode;
635 const char *name = tgtnd->last.name;
636 int len = tgtnd->last.len;
637 struct ptlrpc_request *request = NULL;
638 struct mdc_op_data op_data;
640 struct ll_sb_info *sbi = ll_i2sbi(dir);
643 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),dir=%lu/%u(%p),target=%s\n",
644 src->i_ino, src->i_generation, src,
645 dir->i_ino, dir->i_generation, dir, name);
647 ll_prepare_mdc_op_data(&op_data, src, dir, name, len, 0);
648 err = md_link(sbi->ll_mdc_exp, &op_data, &request);
649 ptlrpc_req_finished(request);
655 static int ll_mkdir_raw(struct nameidata *nd, int mode)
657 struct inode *dir = nd->dentry->d_inode;
658 const char *name = nd->last.name;
659 int len = nd->last.len;
660 struct ptlrpc_request *request = NULL;
661 struct ll_sb_info *sbi = ll_i2sbi(dir);
662 struct mdc_op_data op_data;
665 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
666 name, dir->i_ino, dir->i_generation, dir);
668 mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
669 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
670 err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
671 current->fsuid, current->fsgid, 0, &request);
672 ptlrpc_req_finished(request);
676 static int ll_rmdir_raw(struct nameidata *nd)
678 struct inode *dir = nd->dentry->d_inode;
679 const char *name = nd->last.name;
680 int len = nd->last.len;
681 struct ptlrpc_request *request = NULL;
682 struct mdc_op_data op_data;
685 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
686 name, dir->i_ino, dir->i_generation, dir);
688 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
689 rc = md_unlink(ll_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
690 ptlrpc_req_finished(request);
694 int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
696 struct mds_body *body;
697 struct lov_mds_md *eadata;
698 struct lov_stripe_md *lsm = NULL;
699 struct obd_trans_info oti = { 0 };
704 /* req is swabbed so this is safe */
705 body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
707 if (!(body->valid & OBD_MD_FLEASIZE))
710 if (body->eadatasize == 0) {
711 CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
712 GOTO(out, rc = -EPROTO);
715 /* The MDS sent back the EA because we unlinked the last reference
716 * to this file. Use this EA to unlink the objects on the OST.
717 * It's opaque so we don't swab here; we leave it to obd_unpackmd() to
718 * check it is complete and sensible. */
719 eadata = lustre_swab_repbuf(request, 1, body->eadatasize, NULL);
720 LASSERT(eadata != NULL);
721 if (eadata == NULL) {
722 CERROR("Can't unpack MDS EA data\n");
723 GOTO(out, rc = -EPROTO);
726 rc = obd_unpackmd(ll_i2obdexp(dir), &lsm, eadata, body->eadatasize);
728 CERROR("obd_unpackmd: %d\n", rc);
731 LASSERT(rc >= sizeof(*lsm));
735 GOTO(out_free_memmd, rc = -ENOMEM);
737 oa->o_id = lsm->lsm_object_id;
738 oa->o_gr = lsm->lsm_object_gr;
739 oa->o_mode = body->mode & S_IFMT;
740 oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP;
742 if (body->valid & OBD_MD_FLCOOKIE) {
743 oa->o_valid |= OBD_MD_FLCOOKIE;
745 lustre_msg_buf(request->rq_repmsg, 2,
746 sizeof(struct llog_cookie) *
747 lsm->lsm_stripe_count);
748 if (oti.oti_logcookies == NULL) {
749 oa->o_valid &= ~OBD_MD_FLCOOKIE;
750 body->valid &= ~OBD_MD_FLCOOKIE;
754 rc = obd_destroy(ll_i2obdexp(dir), oa, lsm, &oti);
757 CERROR("obd destroy objid "LPX64" error %d\n",
758 lsm->lsm_object_id, rc);
760 obd_free_memmd(ll_i2obdexp(dir), &lsm);
765 static int ll_unlink_raw(struct nameidata *nd)
767 struct inode *dir = nd->dentry->d_inode;
768 const char *name = nd->last.name;
769 int len = nd->last.len;
770 struct ptlrpc_request *request = NULL;
771 struct mdc_op_data op_data;
774 CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
775 name, dir->i_ino, dir->i_generation, dir);
777 ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
778 rc = md_unlink(ll_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
782 rc = ll_objects_destroy(request, dir);
784 ptlrpc_req_finished(request);
788 static int ll_rename_raw(struct nameidata *oldnd, struct nameidata *newnd)
790 struct inode *src = oldnd->dentry->d_inode;
791 struct inode *tgt = newnd->dentry->d_inode;
792 const char *oldname = oldnd->last.name;
793 int oldlen = oldnd->last.len;
794 const char *newname = newnd->last.name;
795 int newlen = newnd->last.len;
796 struct ptlrpc_request *request = NULL;
797 struct ll_sb_info *sbi = ll_i2sbi(src);
798 struct mdc_op_data op_data;
801 CDEBUG(D_VFSTRACE, "VFS Op:oldname=%s,src_dir=%lu/%u(%p),newname=%s,"
802 "tgt_dir=%lu/%u(%p)\n", oldname, src->i_ino, src->i_generation,
803 src, newname, tgt->i_ino, tgt->i_generation, tgt);
805 ll_prepare_mdc_op_data(&op_data, src, tgt, NULL, 0, 0);
806 err = md_rename(sbi->ll_mdc_exp, &op_data,
807 oldname, oldlen, newname, newlen, &request);
809 err = ll_objects_destroy(request, src);
812 ptlrpc_req_finished(request);
817 struct inode_operations ll_dir_inode_operations = {
818 link_raw: ll_link_raw,
819 unlink_raw: ll_unlink_raw,
820 symlink_raw: ll_symlink_raw,
821 mkdir_raw: ll_mkdir_raw,
822 rmdir_raw: ll_rmdir_raw,
823 mknod_raw: ll_mknod_raw,
825 rename_raw: ll_rename_raw,
827 setattr_raw: ll_setattr_raw,
828 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
829 create_it: ll_create_it,
830 lookup_it: ll_lookup_it,
831 revalidate_it: ll_inode_revalidate_it,
833 lookup: ll_lookup_nd,
834 create: ll_create_nd,
835 getattr_it: ll_getattr,