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