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