Whamcloud - gitweb
3e12e5cd9c4248428c65d1f5d23b4c56aad993e3
[fs/lustre-release.git] / lustre / llite / namei.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  *
32  * Copyright (c) 2011 Whamcloud, Inc.
33  *
34  */
35 /*
36  * This file is part of Lustre, http://www.lustre.org/
37  * Lustre is a trademark of Sun Microsystems, Inc.
38  */
39
40 #include <linux/fs.h>
41 #include <linux/sched.h>
42 #include <linux/mm.h>
43 #include <linux/smp_lock.h>
44 #include <linux/quotaops.h>
45 #include <linux/highmem.h>
46 #include <linux/pagemap.h>
47
48 #define DEBUG_SUBSYSTEM S_LLITE
49
50 #include <obd_support.h>
51 #include <lustre_fid.h>
52 #include <lustre_lite.h>
53 #include <lustre_dlm.h>
54 #include <lustre_ver.h>
55 #include <lustre_mdc.h>
56 #include "llite_internal.h"
57
58 /*
59  * Check if we have something mounted at the named dchild.
60  * In such a case there would always be dentry present.
61  */
62 static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild,
63                            struct qstr *name)
64 {
65         int mounted = 0;
66
67         if (unlikely(dchild)) {
68                 mounted = d_mountpoint(dchild);
69         } else if (dparent) {
70                 dchild = d_lookup(dparent, name);
71                 if (dchild) {
72                         mounted = d_mountpoint(dchild);
73                         dput(dchild);
74                 }
75         }
76         return mounted;
77 }
78
79 int ll_unlock(__u32 mode, struct lustre_handle *lockh)
80 {
81         ENTRY;
82
83         ldlm_lock_decref(lockh, mode);
84
85         RETURN(0);
86 }
87
88
89 /* called from iget5_locked->find_inode() under inode_lock spinlock */
90 static int ll_test_inode(struct inode *inode, void *opaque)
91 {
92         struct ll_inode_info *lli = ll_i2info(inode);
93         struct lustre_md     *md = opaque;
94
95         if (unlikely(!(md->body->valid & OBD_MD_FLID))) {
96                 CERROR("MDS body missing FID\n");
97                 return 0;
98         }
99
100         if (!lu_fid_eq(&lli->lli_fid, &md->body->fid1))
101                 return 0;
102
103         return 1;
104 }
105
106 static int ll_set_inode(struct inode *inode, void *opaque)
107 {
108         struct ll_inode_info *lli = ll_i2info(inode);
109         struct mdt_body *body = ((struct lustre_md *)opaque)->body;
110
111         if (unlikely(!(body->valid & OBD_MD_FLID))) {
112                 CERROR("MDS body missing FID\n");
113                 return -EINVAL;
114         }
115
116         lli->lli_fid = body->fid1;
117         return 0;
118 }
119
120
121 /*
122  * Get an inode by inode number (already instantiated by the intent lookup).
123  * Returns inode or NULL
124  */
125 struct inode *ll_iget(struct super_block *sb, ino_t hash,
126                       struct lustre_md *md)
127 {
128         struct inode         *inode;
129         ENTRY;
130
131         LASSERT(hash != 0);
132         inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md);
133
134         if (inode) {
135                 if (inode->i_state & I_NEW) {
136                         int rc;
137
138                         ll_read_inode2(inode, md);
139                         rc = cl_inode_init(inode, md);
140                         if (rc != 0) {
141                                 md->lsm = NULL;
142                                 make_bad_inode(inode);
143                                 unlock_new_inode(inode);
144                                 iput(inode);
145                                 inode = ERR_PTR(rc);
146                         } else
147                                 unlock_new_inode(inode);
148                 } else if (!(inode->i_state & (I_FREEING | I_CLEAR)))
149                                 ll_update_inode(inode, md);
150                 CDEBUG(D_VFSTRACE, "got inode: %p for "DFID"\n",
151                        inode, PFID(&md->body->fid1));
152         }
153         RETURN(inode);
154 }
155
156 static void ll_drop_negative_dentry(struct inode *dir)
157 {
158         struct dentry *dentry, *tmp_alias, *tmp_subdir;
159
160         cfs_spin_lock(&ll_lookup_lock);
161         spin_lock(&dcache_lock);
162 restart:
163         list_for_each_entry_safe(dentry, tmp_alias,
164                                  &dir->i_dentry,d_alias) {
165                 if (!list_empty(&dentry->d_subdirs)) {
166                         struct dentry *child;
167                         list_for_each_entry_safe(child, tmp_subdir,
168                                                  &dentry->d_subdirs,
169                                                  d_child) {
170                                 /* XXX Print some debug here? */
171                                 if (!child->d_inode)
172                                 /* Negative dentry. If we were
173                                    dropping dcache lock, go
174                                    throught the list again */
175                                         if (ll_drop_dentry(child))
176                                                 goto restart;
177                         }
178                 }
179         }
180         spin_unlock(&dcache_lock);
181         cfs_spin_unlock(&ll_lookup_lock);
182 }
183
184
185 int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
186                        void *data, int flag)
187 {
188         int rc;
189         struct lustre_handle lockh;
190         ENTRY;
191
192         switch (flag) {
193         case LDLM_CB_BLOCKING:
194                 ldlm_lock2handle(lock, &lockh);
195                 rc = ldlm_cli_cancel(&lockh);
196                 if (rc < 0) {
197                         CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc);
198                         RETURN(rc);
199                 }
200                 break;
201         case LDLM_CB_CANCELING: {
202                 struct inode *inode = ll_inode_from_lock(lock);
203                 struct ll_inode_info *lli;
204                 __u64 bits = lock->l_policy_data.l_inodebits.bits;
205                 struct lu_fid *fid;
206                 ldlm_mode_t mode = lock->l_req_mode;
207
208                 /* Invalidate all dentries associated with this inode */
209                 if (inode == NULL)
210                         break;
211
212                 LASSERT(lock->l_flags & LDLM_FL_CANCELING);
213                 /* For OPEN locks we differentiate between lock modes - CR, CW. PR - bug 22891 */
214                 if (bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE))
215                         ll_have_md_lock(inode, &bits, LCK_MINMODE);
216
217                 if (bits & MDS_INODELOCK_OPEN)
218                         ll_have_md_lock(inode, &bits, mode);
219
220                 fid = ll_inode2fid(inode);
221                 if (lock->l_resource->lr_name.name[0] != fid_seq(fid) ||
222                     lock->l_resource->lr_name.name[1] != fid_oid(fid) ||
223                     lock->l_resource->lr_name.name[2] != fid_ver(fid)) {
224                         LDLM_ERROR(lock, "data mismatch with object "
225                                    DFID" (%p)", PFID(fid), inode);
226                 }
227
228                 if (bits & MDS_INODELOCK_OPEN) {
229                         int flags = 0;
230                         switch (lock->l_req_mode) {
231                         case LCK_CW:
232                                 flags = FMODE_WRITE;
233                                 break;
234                         case LCK_PR:
235                                 flags = FMODE_EXEC;
236                                 break;
237                         case LCK_CR:
238                                 flags = FMODE_READ;
239                                 break;
240                         default:
241                                 CERROR("Unexpected lock mode for OPEN lock "
242                                        "%d, inode %ld\n", lock->l_req_mode,
243                                        inode->i_ino);
244                         }
245                         ll_md_real_close(inode, flags);
246                 }
247
248                 lli = ll_i2info(inode);
249                 if (bits & MDS_INODELOCK_UPDATE)
250                         lli->lli_flags &= ~LLIF_MDS_SIZE_LOCK;
251
252                 if (S_ISDIR(inode->i_mode) &&
253                      (bits & MDS_INODELOCK_UPDATE)) {
254                         CDEBUG(D_INODE, "invalidating inode %lu\n",
255                                inode->i_ino);
256                         truncate_inode_pages(inode->i_mapping, 0);
257                         ll_drop_negative_dentry(inode);
258                 }
259
260                 if (inode->i_sb->s_root &&
261                     inode != inode->i_sb->s_root->d_inode &&
262                     (bits & MDS_INODELOCK_LOOKUP))
263                         ll_unhash_aliases(inode);
264                 iput(inode);
265                 break;
266         }
267         default:
268                 LBUG();
269         }
270
271         RETURN(0);
272 }
273
274 __u32 ll_i2suppgid(struct inode *i)
275 {
276         if (cfs_curproc_is_in_groups(i->i_gid))
277                 return (__u32)i->i_gid;
278         else
279                 return (__u32)(-1);
280 }
281
282 /* Pack the required supplementary groups into the supplied groups array.
283  * If we don't need to use the groups from the target inode(s) then we
284  * instead pack one or more groups from the user's supplementary group
285  * array in case it might be useful.  Not needed if doing an MDS-side upcall. */
286 void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)
287 {
288 #if 0
289         int i;
290 #endif
291
292         LASSERT(i1 != NULL);
293         LASSERT(suppgids != NULL);
294
295         suppgids[0] = ll_i2suppgid(i1);
296
297         if (i2)
298                 suppgids[1] = ll_i2suppgid(i2);
299                 else
300                         suppgids[1] = -1;
301
302 #if 0
303         for (i = 0; i < current_ngroups; i++) {
304                 if (suppgids[0] == -1) {
305                         if (current_groups[i] != suppgids[1])
306                                 suppgids[0] = current_groups[i];
307                         continue;
308                 }
309                 if (suppgids[1] == -1) {
310                         if (current_groups[i] != suppgids[0])
311                                 suppgids[1] = current_groups[i];
312                         continue;
313                 }
314                 break;
315         }
316 #endif
317 }
318
319 static void ll_d_add(struct dentry *de, struct inode *inode)
320 {
321         CDEBUG(D_DENTRY, "adding inode %p to dentry %p\n", inode, de);
322         /* d_instantiate */
323         if (!list_empty(&de->d_alias)) {
324                 spin_unlock(&dcache_lock);
325                 CERROR("dentry %.*s %p alias next %p, prev %p\n",
326                        de->d_name.len, de->d_name.name, de,
327                        de->d_alias.next, de->d_alias.prev);
328                 LBUG();
329         }
330         if (inode)
331                 list_add(&de->d_alias, &inode->i_dentry);
332         de->d_inode = inode;
333
334         /* d_rehash */
335         if (!d_unhashed(de)) {
336                 spin_unlock(&dcache_lock);
337                 CERROR("dentry %.*s %p hash next %p\n",
338                        de->d_name.len, de->d_name.name, de, de->d_hash.next);
339                 LBUG();
340         }
341         d_rehash_cond(de, 0);
342 }
343
344 /* Search "inode"'s alias list for a dentry that has the same name and parent
345  * as de.  If found, return it.  If not found, return de.
346  * Lustre can't use d_add_unique because don't unhash aliases for directory
347  * in ll_revalidate_it.  After revaliadate inode will be have hashed aliases
348  * and it triggers BUG_ON in d_instantiate_unique (bug #10954).
349  */
350 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
351 {
352         struct list_head *tmp;
353         struct dentry *dentry;
354         struct dentry *last_discon = NULL;
355
356         cfs_spin_lock(&ll_lookup_lock);
357         spin_lock(&dcache_lock);
358         list_for_each(tmp, &inode->i_dentry) {
359                 dentry = list_entry(tmp, struct dentry, d_alias);
360
361                 /* We are called here with 'de' already on the aliases list. */
362                 if (unlikely(dentry == de)) {
363                         CERROR("whoops\n");
364                         continue;
365                 }
366
367                 if (dentry->d_flags & DCACHE_DISCONNECTED) {
368                         /* LASSERT(last_discon == NULL); LU-405, bz 20055 */
369                         last_discon = dentry;
370                         continue;
371                 }
372
373                 if (dentry->d_parent != de->d_parent)
374                         continue;
375
376                 if (dentry->d_name.hash != de->d_name.hash)
377                         continue;
378
379                 if (dentry->d_name.len != de->d_name.len)
380                         continue;
381
382                 if (memcmp(dentry->d_name.name, de->d_name.name,
383                            de->d_name.len) != 0)
384                         continue;
385
386                 dget_locked(dentry);
387                 lock_dentry(dentry);
388                 __d_drop(dentry);
389                 unlock_dentry(dentry);
390                 ll_dops_init(dentry, 0, 1);
391                 d_rehash_cond(dentry, 0); /* avoid taking dcache_lock inside */
392                 spin_unlock(&dcache_lock);
393                 cfs_spin_unlock(&ll_lookup_lock);
394                 iput(inode);
395                 CDEBUG(D_DENTRY, "alias dentry %.*s (%p) parent %p inode %p "
396                        "refc %d\n", de->d_name.len, de->d_name.name, de,
397                        de->d_parent, de->d_inode, atomic_read(&de->d_count));
398                 return dentry;
399         }
400
401         if (last_discon) {
402                 CDEBUG(D_DENTRY, "Reuse disconnected dentry %p inode %p "
403                         "refc %d\n", last_discon, last_discon->d_inode,
404                         atomic_read(&last_discon->d_count));
405                 dget_locked(last_discon);
406                 lock_dentry(last_discon);
407                 last_discon->d_flags |= DCACHE_LUSTRE_INVALID;
408                 unlock_dentry(last_discon);
409                 spin_unlock(&dcache_lock);
410                 cfs_spin_unlock(&ll_lookup_lock);
411                 ll_dops_init(last_discon, 1, 1);
412                 d_rehash(de);
413                 d_move(last_discon, de);
414                 iput(inode);
415                 return last_discon;
416         }
417         lock_dentry(de);
418         de->d_flags |= DCACHE_LUSTRE_INVALID;
419         unlock_dentry(de);
420         ll_d_add(de, inode);
421
422         spin_unlock(&dcache_lock);
423         cfs_spin_unlock(&ll_lookup_lock);
424
425         return de;
426 }
427
428 int ll_lookup_it_finish(struct ptlrpc_request *request,
429                         struct lookup_intent *it, void *data)
430 {
431         struct it_cb_data *icbd = data;
432         struct dentry **de = icbd->icbd_childp;
433         struct inode *parent = icbd->icbd_parent;
434         struct ll_sb_info *sbi = ll_i2sbi(parent);
435         struct inode *inode = NULL;
436         int rc;
437         ENTRY;
438
439         /* NB 1 request reference will be taken away by ll_intent_lock()
440          * when I return */
441         if (!it_disposition(it, DISP_LOOKUP_NEG)) {
442                 struct dentry *save = *de;
443                 __u32 bits;
444
445                 rc = ll_prep_inode(&inode, request, (*de)->d_sb);
446                 if (rc)
447                         RETURN(rc);
448
449                 CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
450                        inode, inode->i_ino, inode->i_generation);
451                 md_set_lock_data(sbi->ll_md_exp,
452                                  &it->d.lustre.it_lock_handle, inode, &bits);
453
454                 /* We used to query real size from OSTs here, but actually
455                    this is not needed. For stat() calls size would be updated
456                    from subsequent do_revalidate()->ll_inode_revalidate_it() in
457                    2.4 and
458                    vfs_getattr_it->ll_getattr()->ll_inode_revalidate_it() in 2.6
459                    Everybody else who needs correct file size would call
460                    cl_glimpse_size or some equivalent themselves anyway.
461                    Also see bug 7198. */
462                 ll_dops_init(*de, 1, 1);
463                 *de = ll_find_alias(inode, *de);
464                 if (*de != save) {
465                         struct ll_dentry_data *lld = ll_d2d(*de);
466
467                         /* just make sure the ll_dentry_data is ready */
468                         if (unlikely(lld == NULL))
469                                 ll_dops_init(*de, 1, 1);
470                 }
471                 /* we have lookup look - unhide dentry */
472                 if (bits & MDS_INODELOCK_LOOKUP) {
473                         lock_dentry(*de);
474                         (*de)->d_flags &= ~DCACHE_LUSTRE_INVALID;
475                         unlock_dentry(*de);
476                 }
477         } else {
478                 __u64 ibits;
479
480                 ll_dops_init(*de, 1, 1);
481                 /* Check that parent has UPDATE lock. If there is none, we
482                    cannot afford to hash this dentry (done by ll_d_add) as it
483                    might get picked up later when UPDATE lock will appear */
484                 ibits = MDS_INODELOCK_UPDATE;
485                 if (ll_have_md_lock(parent, &ibits, LCK_MINMODE)) {
486                         spin_lock(&dcache_lock);
487                         ll_d_add(*de, NULL);
488                         spin_unlock(&dcache_lock);
489                 } else {
490                         /* negative lookup - and don't have update lock to
491                          * parent */
492                         lock_dentry(*de);
493                         (*de)->d_flags |= DCACHE_LUSTRE_INVALID;
494                         unlock_dentry(*de);
495
496                         (*de)->d_inode = NULL;
497                         /* We do not want to hash the dentry if don`t have a
498                          * lock, but if this dentry is later used in d_move,
499                          * we'd hit uninitialised list head d_hash, so we just
500                          * do this to init d_hash field but leave dentry
501                          * unhashed. (bug 10796). */
502                         d_rehash(*de);
503                         d_drop(*de);
504                 }
505         }
506
507         RETURN(0);
508 }
509
510 static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
511                                    struct lookup_intent *it, int lookup_flags)
512 {
513         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
514         struct dentry *save = dentry, *retval;
515         struct ptlrpc_request *req = NULL;
516         struct md_op_data *op_data;
517         struct it_cb_data icbd;
518         __u32 opc;
519         int rc, first = 0;
520         ENTRY;
521
522         if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen)
523                 RETURN(ERR_PTR(-ENAMETOOLONG));
524
525         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n",
526                dentry->d_name.len, dentry->d_name.name, parent->i_ino,
527                parent->i_generation, parent, LL_IT2STR(it));
528
529         if (d_mountpoint(dentry))
530                 CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it));
531
532         ll_frob_intent(&it, &lookup_it);
533
534         /* As do_lookup is called before follow_mount, root dentry may be left
535          * not valid, revalidate it here. */
536         if (parent->i_sb->s_root && (parent->i_sb->s_root->d_inode == parent) &&
537             (it->it_op & (IT_OPEN | IT_CREAT))) {
538                 rc = ll_inode_revalidate_it(parent->i_sb->s_root, it,
539                                             MDS_INODELOCK_LOOKUP);
540                 if (rc)
541                         RETURN(ERR_PTR(rc));
542         }
543
544         if (it->it_op == IT_GETATTR) {
545                 first = ll_statahead_enter(parent, &dentry, 1);
546                 if (first >= 0) {
547                         ll_statahead_exit(parent, dentry, first);
548                         if (first == 1)
549                                 RETURN(retval = dentry);
550                 }
551         }
552
553         icbd.icbd_childp = &dentry;
554         icbd.icbd_parent = parent;
555
556         if (it->it_op & IT_CREAT ||
557             (it->it_op & IT_OPEN && it->it_create_mode & O_CREAT))
558                 opc = LUSTRE_OPC_CREATE;
559         else
560                 opc = LUSTRE_OPC_ANY;
561
562         op_data = ll_prep_md_op_data(NULL, parent, NULL, dentry->d_name.name,
563                                      dentry->d_name.len, lookup_flags, opc,
564                                      NULL);
565         if (IS_ERR(op_data))
566                 RETURN((void *)op_data);
567
568         it->it_create_mode &= ~cfs_curproc_umask();
569
570         rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
571                             lookup_flags, &req, ll_md_blocking_ast, 0);
572         ll_finish_md_op_data(op_data);
573         if (rc < 0)
574                 GOTO(out, retval = ERR_PTR(rc));
575
576         rc = ll_lookup_it_finish(req, it, &icbd);
577         if (rc != 0) {
578                 ll_intent_release(it);
579                 GOTO(out, retval = ERR_PTR(rc));
580         }
581
582         if (first == -EEXIST)
583                 ll_statahead_mark(parent, dentry);
584
585         if ((it->it_op & IT_OPEN) && dentry->d_inode &&
586             !S_ISREG(dentry->d_inode->i_mode) &&
587             !S_ISDIR(dentry->d_inode->i_mode)) {
588                 ll_release_openhandle(dentry, it);
589         }
590         ll_lookup_finish_locks(it, dentry);
591
592         if (dentry == save)
593                 GOTO(out, retval = NULL);
594         else
595                 GOTO(out, retval = dentry);
596  out:
597         if (req)
598                 ptlrpc_req_finished(req);
599         return retval;
600 }
601
602 struct lookup_intent *ll_convert_intent(struct open_intent *oit,
603                                         int lookup_flags)
604 {
605         struct lookup_intent *it;
606
607         OBD_ALLOC(it, sizeof(*it));
608         if (!it)
609                 return ERR_PTR(-ENOMEM);
610
611         if (lookup_flags & LOOKUP_OPEN) {
612                 it->it_op = IT_OPEN;
613                 if (lookup_flags & LOOKUP_CREATE)
614                         it->it_op |= IT_CREAT;
615                 it->it_create_mode = (oit->create_mode & S_IALLUGO) | S_IFREG;
616                 it->it_flags = oit->flags;
617         } else {
618                 it->it_op = IT_GETATTR;
619         }
620
621 #ifndef HAVE_FILE_IN_STRUCT_INTENT
622                 /* Since there is no way to pass our intent to ll_file_open,
623                  * just check the file is there. Actual open will be done
624                  * in ll_file_open */
625                 if (it->it_op & IT_OPEN)
626                         it->it_op = IT_LOOKUP;
627 #endif
628
629         return it;
630 }
631
632 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
633                                    struct nameidata *nd)
634 {
635         struct dentry *de;
636         ENTRY;
637
638         if (nd && !(nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))) {
639                 struct lookup_intent *it;
640
641 #if defined(HAVE_FILE_IN_STRUCT_INTENT) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
642                 /* Did we came here from failed revalidate just to propagate
643                  * its error? */
644                 if (nd->flags & LOOKUP_OPEN)
645                         if (IS_ERR(nd->intent.open.file))
646                                 RETURN((struct dentry *)nd->intent.open.file);
647 #endif
648                 if (ll_d2d(dentry) && ll_d2d(dentry)->lld_it) {
649                         it = ll_d2d(dentry)->lld_it;
650                         ll_d2d(dentry)->lld_it = NULL;
651                 } else {
652                         if ((nd->flags & LOOKUP_CREATE ) && !(nd->flags & LOOKUP_OPEN)) {
653                                 /* We are sure this is new dentry, so we need to create
654                                    our private data and set the dentry ops */ 
655                                 ll_dops_init(dentry, 1, 1);
656                                 RETURN(NULL);
657                         }
658                         it = ll_convert_intent(&nd->intent.open, nd->flags);
659                         if (IS_ERR(it))
660                                 RETURN((struct dentry *)it);
661                 }
662
663                 de = ll_lookup_it(parent, dentry, it, nd->flags);
664                 if (de)
665                         dentry = de;
666                 if ((nd->flags & LOOKUP_OPEN) && !IS_ERR(dentry)) { /* Open */
667                         if (dentry->d_inode &&
668                             it_disposition(it, DISP_OPEN_OPEN)) { /* nocreate */
669 #ifdef HAVE_FILE_IN_STRUCT_INTENT
670                                 if (S_ISFIFO(dentry->d_inode->i_mode)) {
671                                         // We cannot call open here as it would
672                                         // deadlock.
673                                         ptlrpc_req_finished(
674                                                        (struct ptlrpc_request *)
675                                                           it->d.lustre.it_data);
676                                 } else {
677 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
678 /* 2.6.1[456] have a bug in open_namei() that forgets to check
679  * nd->intent.open.file for error, so we need to return it as lookup's result
680  * instead */
681                                         struct file *filp;
682                                         nd->intent.open.file->private_data = it;
683                                         filp =lookup_instantiate_filp(nd,dentry,
684                                                                       NULL);
685                                         if (IS_ERR(filp)) {
686                                                 if (de)
687                                                         dput(de);
688                                                 de = (struct dentry *) filp;
689                                         }
690 #else
691                                         nd->intent.open.file->private_data = it;
692                                         (void)lookup_instantiate_filp(nd,dentry,
693                                                                       NULL);
694 #endif
695
696                                 }
697 #else /* HAVE_FILE_IN_STRUCT_INTENT */
698                                 /* Release open handle as we have no way to
699                                  * pass it to ll_file_open */
700                                 ll_release_openhandle(dentry, it);
701 #endif /* HAVE_FILE_IN_STRUCT_INTENT */
702                         } else if (it_disposition(it, DISP_OPEN_CREATE)) {
703                                 // XXX This can only reliably work on assumption
704                                 // that there are NO hashed negative dentries.
705                                 ll_d2d(dentry)->lld_it = it;
706                                 it = NULL; /* Will be freed in ll_create_nd */
707                                 /* We absolutely depend on ll_create_nd to be
708                                  * called to not leak this intent and possible
709                                  * data attached to it */
710                         }
711                 }
712
713                 if (it) {
714                         ll_intent_release(it);
715                         OBD_FREE(it, sizeof(*it));
716                 }
717         } else {
718                 de = ll_lookup_it(parent, dentry, NULL, 0);
719         }
720
721         RETURN(de);
722 }
723
724 /* We depend on "mode" being set with the proper file type/umask by now */
725 static struct inode *ll_create_node(struct inode *dir, const char *name,
726                                     int namelen, const void *data, int datalen,
727                                     int mode, __u64 extra,
728                                     struct lookup_intent *it)
729 {
730         struct inode *inode = NULL;
731         struct ptlrpc_request *request = NULL;
732         struct ll_sb_info *sbi = ll_i2sbi(dir);
733         int rc;
734         ENTRY;
735
736         LASSERT(it && it->d.lustre.it_disposition);
737
738         LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF));
739         request = it->d.lustre.it_data;
740         it_clear_disposition(it, DISP_ENQ_CREATE_REF);
741         rc = ll_prep_inode(&inode, request, dir->i_sb);
742         if (rc)
743                 GOTO(out, inode = ERR_PTR(rc));
744
745         LASSERT(list_empty(&inode->i_dentry));
746
747         /* We asked for a lock on the directory, but were granted a
748          * lock on the inode.  Since we finally have an inode pointer,
749          * stuff it in the lock. */
750         CDEBUG(D_DLMTRACE, "setting l_ast_data to inode %p (%lu/%u)\n",
751                inode, inode->i_ino, inode->i_generation);
752         md_set_lock_data(sbi->ll_md_exp,
753                          &it->d.lustre.it_lock_handle, inode, NULL);
754         EXIT;
755  out:
756         ptlrpc_req_finished(request);
757         return inode;
758 }
759
760 /*
761  * By the time this is called, we already have created the directory cache
762  * entry for the new file, but it is so far negative - it has no inode.
763  *
764  * We defer creating the OBD object(s) until open, to keep the intent and
765  * non-intent code paths similar, and also because we do not have the MDS
766  * inode number before calling ll_create_node() (which is needed for LOV),
767  * so we would need to do yet another RPC to the MDS to store the LOV EA
768  * data on the MDS.  If needed, we would pass the PACKED lmm as data and
769  * lmm_size in datalen (the MDS still has code which will handle that).
770  *
771  * If the create succeeds, we fill in the inode information
772  * with d_instantiate().
773  */
774 static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
775                         struct lookup_intent *it)
776 {
777         struct inode *inode;
778         int rc = 0;
779         ENTRY;
780
781         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n",
782                dentry->d_name.len, dentry->d_name.name, dir->i_ino,
783                dir->i_generation, dir, LL_IT2STR(it));
784
785         rc = it_open_error(DISP_OPEN_CREATE, it);
786         if (rc)
787                 RETURN(rc);
788
789         inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
790                                NULL, 0, mode, 0, it);
791         if (IS_ERR(inode))
792                 RETURN(PTR_ERR(inode));
793
794         d_instantiate(dentry, inode);
795         /* Negative dentry may be unhashed if parent does not have UPDATE lock,
796          * but some callers, e.g. do_coredump, expect dentry to be hashed after
797          * successful create. Hash it here. */
798         spin_lock(&dcache_lock);
799         if (d_unhashed(dentry))
800                 d_rehash_cond(dentry, 0);
801         spin_unlock(&dcache_lock);
802         RETURN(0);
803 }
804
805 static void ll_update_times(struct ptlrpc_request *request,
806                             struct inode *inode)
807 {
808         struct mdt_body *body = req_capsule_server_get(&request->rq_pill,
809                                                        &RMF_MDT_BODY);
810
811         LASSERT(body);
812         if (body->valid & OBD_MD_FLMTIME &&
813             body->mtime > LTIME_S(inode->i_mtime)) {
814                 CDEBUG(D_INODE, "setting ino %lu mtime from %lu to "LPU64"\n",
815                        inode->i_ino, LTIME_S(inode->i_mtime), body->mtime);
816                 LTIME_S(inode->i_mtime) = body->mtime;
817         }
818         if (body->valid & OBD_MD_FLCTIME &&
819             body->ctime > LTIME_S(inode->i_ctime))
820                 LTIME_S(inode->i_ctime) = body->ctime;
821 }
822
823 static int ll_new_node(struct inode *dir, struct qstr *name,
824                        const char *tgt, int mode, int rdev,
825                        struct dentry *dchild, __u32 opc)
826 {
827         struct ptlrpc_request *request = NULL;
828         struct md_op_data *op_data;
829         struct inode *inode = NULL;
830         struct ll_sb_info *sbi = ll_i2sbi(dir);
831         int tgt_len = 0;
832         int err;
833
834         ENTRY;
835         if (unlikely(tgt != NULL))
836                 tgt_len = strlen(tgt) + 1;
837
838         op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
839                                      name->len, 0, opc, NULL);
840         if (IS_ERR(op_data))
841                 GOTO(err_exit, err = PTR_ERR(op_data));
842
843         err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
844                         cfs_curproc_fsuid(), cfs_curproc_fsgid(),
845                         cfs_curproc_cap_pack(), rdev, &request);
846         ll_finish_md_op_data(op_data);
847         if (err)
848                 GOTO(err_exit, err);
849
850         ll_update_times(request, dir);
851
852         if (dchild) {
853                 err = ll_prep_inode(&inode, request, dchild->d_sb);
854                 if (err)
855                      GOTO(err_exit, err);
856
857                 d_drop(dchild);
858                 d_instantiate(dchild, inode);
859         }
860         EXIT;
861 err_exit:
862         ptlrpc_req_finished(request);
863
864         return err;
865 }
866
867 static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
868                             unsigned rdev, struct dentry *dchild)
869 {
870         int err;
871         ENTRY;
872
873         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p) mode %o dev %x\n",
874                name->len, name->name, dir->i_ino, dir->i_generation, dir,
875                mode, rdev);
876
877         mode &= ~cfs_curproc_umask();
878
879         switch (mode & S_IFMT) {
880         case 0:
881                 mode |= S_IFREG; /* for mode = 0 case, fallthrough */
882         case S_IFREG:
883         case S_IFCHR:
884         case S_IFBLK:
885         case S_IFIFO:
886         case S_IFSOCK:
887                 err = ll_new_node(dir, name, NULL, mode, rdev, dchild,
888                                   LUSTRE_OPC_MKNOD);
889                 break;
890         case S_IFDIR:
891                 err = -EPERM;
892                 break;
893         default:
894                 err = -EINVAL;
895         }
896         RETURN(err);
897 }
898
899 static int ll_create_nd(struct inode *dir, struct dentry *dentry,
900                         int mode, struct nameidata *nd)
901 {
902         struct lookup_intent *it = ll_d2d(dentry)->lld_it;
903         int rc;
904
905         if (!it)
906                 return ll_mknod_generic(dir, &dentry->d_name, mode, 0, dentry);
907
908         ll_d2d(dentry)->lld_it = NULL;
909
910         /* Was there an error? Propagate it! */
911         if (it->d.lustre.it_status) {
912                 rc = it->d.lustre.it_status;
913                 goto out;
914         }
915
916         rc = ll_create_it(dir, dentry, mode, it);
917 #ifdef HAVE_FILE_IN_STRUCT_INTENT
918         if (nd && (nd->flags & LOOKUP_OPEN) && dentry->d_inode) { /* Open */
919                 nd->intent.open.file->private_data = it;
920                 lookup_instantiate_filp(nd, dentry, NULL);
921         }
922 #else
923         ll_release_openhandle(dentry,it);
924 #endif
925
926 out:
927         ll_intent_release(it);
928         OBD_FREE(it, sizeof(*it));
929
930         return rc;
931 }
932
933 static int ll_symlink_generic(struct inode *dir, struct qstr *name,
934                               const char *tgt, struct dentry *dchild)
935 {
936         int err;
937         ENTRY;
938
939         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),target=%.*s\n",
940                name->len, name->name, dir->i_ino, dir->i_generation,
941                dir, 3000, tgt);
942
943         err = ll_new_node(dir, name, (char *)tgt, S_IFLNK | S_IRWXUGO,
944                           0, dchild, LUSTRE_OPC_SYMLINK);
945         RETURN(err);
946 }
947
948 static int ll_link_generic(struct inode *src,  struct inode *dir,
949                            struct qstr *name, struct dentry *dchild)
950 {
951         struct ll_sb_info *sbi = ll_i2sbi(dir);
952         struct ptlrpc_request *request = NULL;
953         struct md_op_data *op_data;
954         int err;
955
956         ENTRY;
957         CDEBUG(D_VFSTRACE,
958                "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%.*s\n",
959                src->i_ino, src->i_generation, src, dir->i_ino,
960                dir->i_generation, dir, name->len, name->name);
961
962         op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len,
963                                      0, LUSTRE_OPC_ANY, NULL);
964         if (IS_ERR(op_data))
965                 RETURN(PTR_ERR(op_data));
966
967         err = md_link(sbi->ll_md_exp, op_data, &request);
968         ll_finish_md_op_data(op_data);
969         if (err)
970                 GOTO(out, err);
971         if (dchild)
972                 d_drop(dchild);
973
974         ll_update_times(request, dir);
975         EXIT;
976 out:
977         ptlrpc_req_finished(request);
978         RETURN(err);
979 }
980
981 static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
982                             int mode, struct dentry *dchild)
983
984 {
985         int err;
986         ENTRY;
987
988         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
989                name->len, name->name, dir->i_ino, dir->i_generation, dir);
990
991         mode = (mode & (S_IRWXUGO|S_ISVTX) & ~cfs_curproc_umask()) | S_IFDIR;
992         err = ll_new_node(dir, name, NULL, mode, 0, dchild, LUSTRE_OPC_MKDIR);
993
994         RETURN(err);
995 }
996
997 /* Try to find the child dentry by its name.
998    If found, put the result fid into @fid. */
999 static void ll_get_child_fid(struct inode * dir, struct qstr *name,
1000                              struct lu_fid *fid)
1001 {
1002         struct dentry *parent, *child;
1003
1004         parent = list_entry(dir->i_dentry.next, struct dentry, d_alias);
1005         child = d_lookup(parent, name);
1006         if (child) {
1007                 if (child->d_inode)
1008                         *fid = *ll_inode2fid(child->d_inode);
1009                 dput(child);
1010         }
1011 }
1012
1013 static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent,
1014                             struct dentry *dchild, struct qstr *name)
1015 {
1016         struct ptlrpc_request *request = NULL;
1017         struct md_op_data *op_data;
1018         int rc;
1019         ENTRY;
1020
1021         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
1022                name->len, name->name, dir->i_ino, dir->i_generation, dir);
1023
1024         if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
1025                 RETURN(-EBUSY);
1026
1027         op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len,
1028                                      S_IFDIR, LUSTRE_OPC_ANY, NULL);
1029         if (IS_ERR(op_data))
1030                 RETURN(PTR_ERR(op_data));
1031
1032         ll_get_child_fid(dir, name, &op_data->op_fid3);
1033         rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1034         ll_finish_md_op_data(op_data);
1035         if (rc == 0)
1036                 ll_update_times(request, dir);
1037         ptlrpc_req_finished(request);
1038         RETURN(rc);
1039 }
1040
1041 int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
1042 {
1043         struct mdt_body *body;
1044         struct lov_mds_md *eadata;
1045         struct lov_stripe_md *lsm = NULL;
1046         struct obd_trans_info oti = { 0 };
1047         struct obdo *oa;
1048         struct obd_capa *oc = NULL;
1049         int rc;
1050         ENTRY;
1051
1052         /* req is swabbed so this is safe */
1053         body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
1054         if (!(body->valid & OBD_MD_FLEASIZE))
1055                 RETURN(0);
1056
1057         if (body->eadatasize == 0) {
1058                 CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
1059                 GOTO(out, rc = -EPROTO);
1060         }
1061
1062         /* The MDS sent back the EA because we unlinked the last reference
1063          * to this file. Use this EA to unlink the objects on the OST.
1064          * It's opaque so we don't swab here; we leave it to obd_unpackmd() to
1065          * check it is complete and sensible. */
1066         eadata = req_capsule_server_sized_get(&request->rq_pill, &RMF_MDT_MD,
1067                                               body->eadatasize);
1068         LASSERT(eadata != NULL);
1069
1070         rc = obd_unpackmd(ll_i2dtexp(dir), &lsm, eadata, body->eadatasize);
1071         if (rc < 0) {
1072                 CERROR("obd_unpackmd: %d\n", rc);
1073                 GOTO(out, rc);
1074         }
1075         LASSERT(rc >= sizeof(*lsm));
1076
1077         OBDO_ALLOC(oa);
1078         if (oa == NULL)
1079                 GOTO(out_free_memmd, rc = -ENOMEM);
1080
1081         oa->o_id = lsm->lsm_object_id;
1082         oa->o_seq = lsm->lsm_object_seq;
1083         oa->o_mode = body->mode & S_IFMT;
1084         oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP;
1085
1086         if (body->valid & OBD_MD_FLCOOKIE) {
1087                 oa->o_valid |= OBD_MD_FLCOOKIE;
1088                 oti.oti_logcookies =
1089                         req_capsule_server_sized_get(&request->rq_pill,
1090                                                      &RMF_LOGCOOKIES,
1091                                                    sizeof(struct llog_cookie) *
1092                                                      lsm->lsm_stripe_count);
1093                 if (oti.oti_logcookies == NULL) {
1094                         oa->o_valid &= ~OBD_MD_FLCOOKIE;
1095                         body->valid &= ~OBD_MD_FLCOOKIE;
1096                 }
1097         }
1098
1099         if (body->valid & OBD_MD_FLOSSCAPA) {
1100                 rc = md_unpack_capa(ll_i2mdexp(dir), request, &RMF_CAPA2, &oc);
1101                 if (rc)
1102                         GOTO(out_free_memmd, rc);
1103         }
1104
1105         rc = obd_destroy(ll_i2dtexp(dir), oa, lsm, &oti, ll_i2mdexp(dir), oc);
1106         capa_put(oc);
1107         OBDO_FREE(oa);
1108         if (rc)
1109                 CERROR("obd destroy objid "LPX64" error %d\n",
1110                        lsm->lsm_object_id, rc);
1111  out_free_memmd:
1112         obd_free_memmd(ll_i2dtexp(dir), &lsm);
1113  out:
1114         return rc;
1115 }
1116
1117 /* ll_unlink_generic() doesn't update the inode with the new link count.
1118  * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there
1119  * is any lock existing. They will recycle dentries and inodes based upon locks
1120  * too. b=20433 */
1121 static int ll_unlink_generic(struct inode *dir, struct dentry *dparent,
1122                              struct dentry *dchild, struct qstr *name)
1123 {
1124         struct ptlrpc_request *request = NULL;
1125         struct md_op_data *op_data;
1126         int rc;
1127         ENTRY;
1128         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
1129                name->len, name->name, dir->i_ino, dir->i_generation, dir);
1130
1131         /*
1132          * XXX: unlink bind mountpoint maybe call to here,
1133          * just check it as vfs_unlink does.
1134          */
1135         if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
1136                 RETURN(-EBUSY);
1137
1138         op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
1139                                      name->len, 0, LUSTRE_OPC_ANY, NULL);
1140         if (IS_ERR(op_data))
1141                 RETURN(PTR_ERR(op_data));
1142
1143         ll_get_child_fid(dir, name, &op_data->op_fid3);
1144         rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1145         ll_finish_md_op_data(op_data);
1146         if (rc)
1147                 GOTO(out, rc);
1148
1149         ll_update_times(request, dir);
1150
1151         rc = ll_objects_destroy(request, dir);
1152  out:
1153         ptlrpc_req_finished(request);
1154         RETURN(rc);
1155 }
1156
1157 static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
1158                              struct dentry *src_dchild, struct qstr *src_name,
1159                              struct inode *tgt, struct dentry *tgt_dparent,
1160                              struct dentry *tgt_dchild, struct qstr *tgt_name)
1161 {
1162         struct ptlrpc_request *request = NULL;
1163         struct ll_sb_info *sbi = ll_i2sbi(src);
1164         struct md_op_data *op_data;
1165         int err;
1166         ENTRY;
1167         CDEBUG(D_VFSTRACE,"VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s,"
1168                "tgt_dir=%lu/%u(%p)\n", src_name->len, src_name->name,
1169                src->i_ino, src->i_generation, src, tgt_name->len,
1170                tgt_name->name, tgt->i_ino, tgt->i_generation, tgt);
1171
1172         if (unlikely(ll_d_mountpoint(src_dparent, src_dchild, src_name) ||
1173             ll_d_mountpoint(tgt_dparent, tgt_dchild, tgt_name)))
1174                 RETURN(-EBUSY);
1175
1176         op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0,
1177                                      LUSTRE_OPC_ANY, NULL);
1178         if (IS_ERR(op_data))
1179                 RETURN(PTR_ERR(op_data));
1180
1181         ll_get_child_fid(src, src_name, &op_data->op_fid3);
1182         ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4);
1183         err = md_rename(sbi->ll_md_exp, op_data,
1184                         src_name->name, src_name->len,
1185                         tgt_name->name, tgt_name->len, &request);
1186         ll_finish_md_op_data(op_data);
1187         if (!err) {
1188                 ll_update_times(request, src);
1189                 ll_update_times(request, tgt);
1190                 err = ll_objects_destroy(request, src);
1191         }
1192
1193         ptlrpc_req_finished(request);
1194
1195         RETURN(err);
1196 }
1197
1198 static int ll_mknod(struct inode *dir, struct dentry *dchild, int mode,
1199                     ll_dev_t rdev)
1200 {
1201         return ll_mknod_generic(dir, &dchild->d_name, mode,
1202                                 old_encode_dev(rdev), dchild);
1203 }
1204
1205 static int ll_unlink(struct inode * dir, struct dentry *dentry)
1206 {
1207         return ll_unlink_generic(dir, NULL, dentry, &dentry->d_name);
1208 }
1209 static int ll_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1210 {
1211         return ll_mkdir_generic(dir, &dentry->d_name, mode, dentry);
1212 }
1213 static int ll_rmdir(struct inode *dir, struct dentry *dentry)
1214 {
1215         return ll_rmdir_generic(dir, NULL, dentry, &dentry->d_name);
1216 }
1217 static int ll_symlink(struct inode *dir, struct dentry *dentry,
1218                       const char *oldname)
1219 {
1220         return ll_symlink_generic(dir, &dentry->d_name, oldname, dentry);
1221 }
1222 static int ll_link(struct dentry *old_dentry, struct inode *dir,
1223                    struct dentry *new_dentry)
1224 {
1225         return ll_link_generic(old_dentry->d_inode, dir, &new_dentry->d_name,
1226                                new_dentry);
1227 }
1228 static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,
1229                      struct inode *new_dir, struct dentry *new_dentry)
1230 {
1231         int err;
1232         err = ll_rename_generic(old_dir, NULL,
1233                                  old_dentry, &old_dentry->d_name,
1234                                  new_dir, NULL, new_dentry,
1235                                  &new_dentry->d_name);
1236         if (!err) {
1237 #ifndef HAVE_FS_RENAME_DOES_D_MOVE
1238                 if (!S_ISDIR(old_dentry->d_inode->i_mode))
1239 #endif
1240                         d_move(old_dentry, new_dentry);
1241         }
1242         return err;
1243 }
1244
1245 struct inode_operations ll_dir_inode_operations = {
1246         .mknod              = ll_mknod,
1247         .lookup             = ll_lookup_nd,
1248         .create             = ll_create_nd,
1249         /* We need all these non-raw things for NFSD, to not patch it. */
1250         .unlink             = ll_unlink,
1251         .mkdir              = ll_mkdir,
1252         .rmdir              = ll_rmdir,
1253         .symlink            = ll_symlink,
1254         .link               = ll_link,
1255         .rename             = ll_rename,
1256         .setattr            = ll_setattr,
1257         .getattr            = ll_getattr,
1258         .permission         = ll_inode_permission,
1259         .setxattr           = ll_setxattr,
1260         .getxattr           = ll_getxattr,
1261         .listxattr          = ll_listxattr,
1262         .removexattr        = ll_removexattr,
1263 };
1264
1265 struct inode_operations ll_special_inode_operations = {
1266         .setattr        = ll_setattr,
1267         .getattr        = ll_getattr,
1268         .permission     = ll_inode_permission,
1269         .setxattr       = ll_setxattr,
1270         .getxattr       = ll_getxattr,
1271         .listxattr      = ll_listxattr,
1272         .removexattr    = ll_removexattr,
1273 };