4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
33 #include <linux/sched.h>
35 #include <linux/file.h>
36 #include <linux/quotaops.h>
37 #include <linux/highmem.h>
38 #include <linux/pagemap.h>
39 #include <linux/user_namespace.h>
40 #include <linux/uidgid.h>
42 #define DEBUG_SUBSYSTEM S_LLITE
44 #include <obd_support.h>
45 #include <lustre_fid.h>
46 #include <lustre_dlm.h>
47 #include "llite_internal.h"
49 #ifndef HAVE_USER_NAMESPACE_ARG
50 #define ll_create_nd(ns, dir, de, mode, ex) ll_create_nd(dir, de, mode, ex)
51 #define ll_mkdir(ns, dir, dch, mode) ll_mkdir(dir, dch, mode)
52 #define ll_mknod(ns, dir, dch, mode, rd) ll_mknod(dir, dch, mode, rd)
53 #ifdef HAVE_IOPS_RENAME_WITH_FLAGS
54 #define ll_rename(ns, src, sdc, tgt, tdc, fl) ll_rename(src, sdc, tgt, tdc, fl)
56 #define ll_rename(ns, src, sdc, tgt, tdc) ll_rename(src, sdc, tgt, tdc)
57 #endif /* HAVE_IOPS_RENAME_WITH_FLAGS */
58 #define ll_symlink(nd, dir, dch, old) ll_symlink(dir, dch, old)
61 static int ll_create_it(struct inode *dir, struct dentry *dentry,
62 struct lookup_intent *it,
63 void *secctx, __u32 secctxlen, bool encrypt,
64 void *encctx, __u32 encctxlen, unsigned int open_flags);
66 /* called from iget5_locked->find_inode() under inode_lock spinlock */
67 static int ll_test_inode(struct inode *inode, void *opaque)
69 struct ll_inode_info *lli = ll_i2info(inode);
70 struct lustre_md *md = opaque;
72 if (unlikely(!(md->body->mbo_valid & OBD_MD_FLID))) {
73 CERROR("MDS body missing FID\n");
77 if (!lu_fid_eq(&lli->lli_fid, &md->body->mbo_fid1))
83 static int ll_set_inode(struct inode *inode, void *opaque)
85 struct ll_inode_info *lli = ll_i2info(inode);
86 struct mdt_body *body = ((struct lustre_md *)opaque)->body;
88 if (unlikely(!(body->mbo_valid & OBD_MD_FLID))) {
89 CERROR("MDS body missing FID\n");
93 lli->lli_fid = body->mbo_fid1;
94 if (unlikely(!(body->mbo_valid & OBD_MD_FLTYPE))) {
95 CERROR("Can not initialize inode "DFID" without object type: "
97 PFID(&lli->lli_fid), body->mbo_valid);
101 inode->i_mode = (inode->i_mode & ~S_IFMT) | (body->mbo_mode & S_IFMT);
102 if (unlikely(inode->i_mode == 0)) {
103 CERROR("Invalid inode "DFID" type\n", PFID(&lli->lli_fid));
114 * Get an inode by inode number(@hash), which is already instantiated by
115 * the intent lookup).
117 struct inode *ll_iget(struct super_block *sb, ino_t hash,
118 struct lustre_md *md)
126 inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md);
128 RETURN(ERR_PTR(-ENOMEM));
130 if (inode->i_state & I_NEW) {
131 rc = ll_read_inode2(inode, md);
132 if (rc == 0 && S_ISREG(inode->i_mode) &&
133 ll_i2info(inode)->lli_clob == NULL)
134 rc = cl_file_inode_init(inode, md);
137 /* Let's clear directory lsm here, otherwise
138 * make_bad_inode() will reset the inode mode
139 * to regular, then ll_clear_inode will not
140 * be able to clear lsm_md */
141 if (S_ISDIR(inode->i_mode))
142 ll_dir_clear_lsm_md(inode);
143 make_bad_inode(inode);
144 unlock_new_inode(inode);
148 inode_has_no_xattr(inode);
149 unlock_new_inode(inode);
151 } else if (is_bad_inode(inode)) {
153 inode = ERR_PTR(-ESTALE);
154 } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) {
155 rc = ll_update_inode(inode, md);
156 CDEBUG(D_VFSTRACE, "got inode: "DFID"(%p): rc = %d\n",
157 PFID(&md->body->mbo_fid1), inode, rc);
159 if (S_ISDIR(inode->i_mode))
160 ll_dir_clear_lsm_md(inode);
169 /* mark negative sub file dentries invalid and prune unused dentries */
170 static void ll_prune_negative_children(struct inode *dir)
172 struct dentry *dentry;
173 struct dentry *child;
178 spin_lock(&dir->i_lock);
179 hlist_for_each_entry(dentry, &dir->i_dentry, d_alias) {
180 spin_lock(&dentry->d_lock);
181 list_for_each_entry(child, &dentry->d_subdirs, d_child) {
185 spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
186 if (lld_is_init(child))
187 ll_d2d(child)->lld_invalid = 1;
188 if (!ll_d_count(child)) {
191 spin_unlock(&child->d_lock);
192 spin_unlock(&dentry->d_lock);
193 spin_unlock(&dir->i_lock);
195 CDEBUG(D_DENTRY, "prune negative dentry %pd\n",
201 spin_unlock(&child->d_lock);
203 spin_unlock(&dentry->d_lock);
205 spin_unlock(&dir->i_lock);
210 int ll_test_inode_by_fid(struct inode *inode, void *opaque)
212 return lu_fid_eq(&ll_i2info(inode)->lli_fid, opaque);
215 static int ll_dom_lock_cancel(struct inode *inode, struct ldlm_lock *lock)
218 struct ll_inode_info *lli = ll_i2info(inode);
223 env = cl_env_get(&refcheck);
225 RETURN(PTR_ERR(env));
227 OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_REPLAY_PAUSE, cfs_fail_val);
229 /* reach MDC layer to flush data under the DoM ldlm lock */
230 rc = cl_object_flush(env, lli->lli_clob, lock);
231 if (rc == -ENODATA) {
232 CDEBUG(D_INODE, "inode "DFID" layout has no DoM stripe\n",
233 PFID(ll_inode2fid(inode)));
234 /* most likely result of layout change, do nothing */
238 cl_env_put(env, &refcheck);
242 static void ll_lock_cancel_bits(struct ldlm_lock *lock, __u64 to_cancel)
244 struct inode *inode = ll_inode_from_resource_lock(lock);
245 struct ll_inode_info *lli;
246 __u64 bits = to_cancel;
252 /* That means the inode is evicted most likely and may cause
253 * the skipping of lock cleanups below, so print the message
256 if (lock->l_resource->lr_lvb_inode)
258 "can't take inode for the lock (%sevicted)\n",
259 lock->l_resource->lr_lvb_inode->i_state &
260 I_FREEING ? "" : "not ");
264 if (!fid_res_name_eq(ll_inode2fid(inode),
265 &lock->l_resource->lr_name)) {
266 LDLM_ERROR(lock, "data mismatch with object "DFID"(%p)",
267 PFID(ll_inode2fid(inode)), inode);
271 if (bits & MDS_INODELOCK_XATTR) {
272 ll_xattr_cache_empty(inode);
273 bits &= ~MDS_INODELOCK_XATTR;
276 /* For OPEN locks we differentiate between lock modes
277 * LCK_CR, LCK_CW, LCK_PR - bug 22891 */
278 if (bits & MDS_INODELOCK_OPEN)
279 ll_have_md_lock(inode, &bits, lock->l_req_mode);
281 if (bits & MDS_INODELOCK_OPEN) {
284 switch (lock->l_req_mode) {
295 LDLM_ERROR(lock, "bad lock mode for OPEN lock");
299 ll_md_real_close(inode, fmode);
301 bits &= ~MDS_INODELOCK_OPEN;
304 if (bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
305 MDS_INODELOCK_LAYOUT | MDS_INODELOCK_PERM |
307 ll_have_md_lock(inode, &bits, LCK_MINMODE);
309 if (bits & MDS_INODELOCK_DOM) {
310 rc = ll_dom_lock_cancel(inode, lock);
312 CDEBUG(D_INODE, "cannot flush DoM data "
314 PFID(ll_inode2fid(inode)), rc);
317 if (bits & MDS_INODELOCK_LAYOUT) {
318 struct cl_object_conf conf = {
319 .coc_opc = OBJECT_CONF_INVALIDATE,
323 rc = ll_layout_conf(inode, &conf);
325 CDEBUG(D_INODE, "cannot invalidate layout of "
327 PFID(ll_inode2fid(inode)), rc);
330 lli = ll_i2info(inode);
332 if (bits & MDS_INODELOCK_UPDATE)
333 set_bit(LLIF_UPDATE_ATIME, &lli->lli_flags);
335 if ((bits & MDS_INODELOCK_UPDATE) && S_ISDIR(inode->i_mode)) {
336 CDEBUG(D_INODE, "invalidating inode "DFID" lli = %p, "
337 "pfid = "DFID"\n", PFID(ll_inode2fid(inode)),
338 lli, PFID(&lli->lli_pfid));
339 truncate_inode_pages(inode->i_mapping, 0);
341 if (unlikely(!fid_is_zero(&lli->lli_pfid))) {
342 struct inode *master_inode = NULL;
345 /* This is slave inode, since all of the child dentry
346 * is connected on the master inode, so we have to
347 * invalidate the negative children on master inode */
348 CDEBUG(D_INODE, "Invalidate s"DFID" m"DFID"\n",
349 PFID(ll_inode2fid(inode)), PFID(&lli->lli_pfid));
351 hash = cl_fid_build_ino(&lli->lli_pfid,
352 ll_need_32bit_api(ll_i2sbi(inode)));
354 /* Do not lookup the inode with ilookup5, otherwise
355 * it will cause dead lock,
356 * 1. Client1 send chmod req to the MDT0, then on MDT0,
357 * it enqueues master and all of its slaves lock,
358 * (mdt_attr_set() -> mdt_lock_slaves()), after gets
359 * master and stripe0 lock, it will send the enqueue
360 * req (for stripe1) to MDT1, then MDT1 finds the lock
361 * has been granted to client2. Then MDT1 sends blocking
363 * 2. At the same time, client2 tries to unlink
364 * the striped dir (rm -rf striped_dir), and during
365 * lookup, it will hold the master inode of the striped
366 * directory, whose inode state is NEW, then tries to
367 * revalidate all of its slaves, (ll_prep_inode()->
368 * ll_iget()->ll_read_inode2()-> ll_update_inode().).
369 * And it will be blocked on the server side because
371 * 3. Then the client get the blocking_ast req, cancel
372 * the lock, but being blocked if using ->ilookup5()),
373 * because master inode state is NEW. */
374 master_inode = ilookup5_nowait(inode->i_sb, hash,
375 ll_test_inode_by_fid,
376 (void *)&lli->lli_pfid);
378 ll_prune_negative_children(master_inode);
382 ll_prune_negative_children(inode);
386 /* at umount s_root becomes NULL */
387 if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) &&
388 inode->i_sb->s_root && !is_root_inode(inode))
389 ll_prune_aliases(inode);
391 if (bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM))
392 forget_all_cached_acls(inode);
398 /* Check if the given lock may be downgraded instead of canceling and
399 * that convert is really needed. */
400 int ll_md_need_convert(struct ldlm_lock *lock)
402 struct ldlm_namespace *ns = ldlm_lock_to_ns(lock);
404 __u64 wanted = lock->l_policy_data.l_inodebits.cancel_bits;
405 __u64 bits = lock->l_policy_data.l_inodebits.bits & ~wanted;
406 enum ldlm_mode mode = LCK_MINMODE;
408 if (!lock->l_conn_export ||
409 !exp_connect_lock_convert(lock->l_conn_export))
412 if (!wanted || !bits || ldlm_is_cancel(lock))
415 /* do not convert locks other than DOM for now */
416 if (!((bits | wanted) & MDS_INODELOCK_DOM))
419 /* We may have already remaining bits in some other lock so
420 * lock convert will leave us just extra lock for the same bit.
421 * Check if client has other lock with the same bits and the same
422 * or lower mode and don't convert if any.
424 switch (lock->l_req_mode) {
438 /* do not convert other modes */
442 /* is lock is too old to be converted? */
443 lock_res_and_lock(lock);
444 if (ktime_after(ktime_get(),
445 ktime_add(lock->l_last_used, ns->ns_dirty_age_limit))) {
446 unlock_res_and_lock(lock);
449 unlock_res_and_lock(lock);
451 inode = ll_inode_from_resource_lock(lock);
452 ll_have_md_lock(inode, &bits, mode);
457 int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *ld,
458 void *data, int flag)
460 struct lustre_handle lockh;
466 case LDLM_CB_BLOCKING:
468 __u64 cancel_flags = LCF_ASYNC;
470 /* if lock convert is not needed then still have to
471 * pass lock via ldlm_cli_convert() to keep all states
472 * correct, set cancel_bits to full lock bits to cause
473 * full cancel to happen.
475 if (!ll_md_need_convert(lock)) {
476 lock_res_and_lock(lock);
477 lock->l_policy_data.l_inodebits.cancel_bits =
478 lock->l_policy_data.l_inodebits.bits;
479 unlock_res_and_lock(lock);
481 rc = ldlm_cli_convert(lock, cancel_flags);
484 /* continue with cancel otherwise */
485 ldlm_lock2handle(lock, &lockh);
486 rc = ldlm_cli_cancel(&lockh, cancel_flags);
488 CDEBUG(D_INODE, "ldlm_cli_cancel: rc = %d\n", rc);
493 case LDLM_CB_CANCELING:
495 __u64 to_cancel = lock->l_policy_data.l_inodebits.bits;
497 /* Nothing to do for non-granted locks */
498 if (!ldlm_is_granted(lock))
501 /* If 'ld' is supplied then bits to be cancelled are passed
502 * implicitly by lock converting and cancel_bits from 'ld'
503 * should be used. Otherwise full cancel is being performed
504 * and lock inodebits are used.
506 * Note: we cannot rely on cancel_bits in lock itself at this
507 * moment because they can be changed by concurrent thread,
508 * so ldlm_cli_inodebits_convert() pass cancel bits implicitly
512 /* partial bits cancel allowed only during convert */
513 LASSERT(ldlm_is_converting(lock));
514 /* mask cancel bits by lock bits so only no any unused
515 * bits are passed to ll_lock_cancel_bits()
517 to_cancel &= ld->l_policy_data.l_inodebits.cancel_bits;
519 ll_lock_cancel_bits(lock, to_cancel);
529 __u32 ll_i2suppgid(struct inode *i)
531 if (in_group_p(i->i_gid))
532 return (__u32)from_kgid(&init_user_ns, i->i_gid);
534 return (__u32) __kgid_val(INVALID_GID);
537 /* Pack the required supplementary groups into the supplied groups array.
538 * If we don't need to use the groups from the target inode(s) then we
539 * instead pack one or more groups from the user's supplementary group
540 * array in case it might be useful. Not needed if doing an MDS-side upcall. */
541 void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)
544 LASSERT(suppgids != NULL);
546 suppgids[0] = ll_i2suppgid(i1);
549 suppgids[1] = ll_i2suppgid(i2);
555 * try to reuse three types of dentry:
556 * 1. unhashed alias, this one is unhashed by d_invalidate (but it may be valid
557 * by concurrent .revalidate).
558 * 2. INVALID alias (common case for no valid ldlm lock held, but this flag may
559 * be cleared by others calling d_lustre_revalidate).
560 * 3. DISCONNECTED alias.
562 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
564 struct dentry *alias, *discon_alias, *invalid_alias;
566 if (hlist_empty(&inode->i_dentry))
569 discon_alias = invalid_alias = NULL;
571 spin_lock(&inode->i_lock);
572 hlist_for_each_entry(alias, &inode->i_dentry, d_alias) {
573 LASSERT(alias != dentry);
575 spin_lock(&alias->d_lock);
576 if ((alias->d_flags & DCACHE_DISCONNECTED) &&
577 S_ISDIR(inode->i_mode))
578 /* LASSERT(last_discon == NULL); LU-405, bz 20055 */
579 discon_alias = alias;
580 else if (alias->d_parent == dentry->d_parent &&
581 alias->d_name.hash == dentry->d_name.hash &&
582 alias->d_name.len == dentry->d_name.len &&
583 memcmp(alias->d_name.name, dentry->d_name.name,
584 dentry->d_name.len) == 0)
585 invalid_alias = alias;
586 spin_unlock(&alias->d_lock);
591 alias = invalid_alias ?: discon_alias ?: NULL;
593 spin_lock(&alias->d_lock);
595 spin_unlock(&alias->d_lock);
597 spin_unlock(&inode->i_lock);
603 * Similar to d_splice_alias(), but lustre treats invalid alias
604 * similar to DCACHE_DISCONNECTED, and tries to use it anyway.
606 struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
611 new = ll_find_alias(inode, de);
613 if (!ll_d_setup(new, true))
614 return ERR_PTR(-ENOMEM);
618 "Reuse dentry %p inode %p refc %d flags %#x\n",
619 new, new->d_inode, ll_d_count(new), new->d_flags);
623 if (!ll_d_setup(de, false))
624 return ERR_PTR(-ENOMEM);
627 /* this needs only to be done for foreign symlink dirs as
628 * DCACHE_SYMLINK_TYPE is already set by d_flags_for_inode()
629 * kernel routine for files with symlink ops (ie, real symlink)
631 if (inode && S_ISDIR(inode->i_mode) &&
632 ll_sbi_has_foreign_symlink(ll_i2sbi(inode)) &&
633 #ifdef HAVE_IOP_GET_LINK
634 inode->i_op->get_link) {
636 inode->i_op->follow_link) {
638 CDEBUG(D_INFO, "%s: inode "DFID": faking foreign dir as a symlink\n",
639 ll_i2sbi(inode)->ll_fsname, PFID(ll_inode2fid(inode)));
640 spin_lock(&de->d_lock);
641 /* like d_flags_for_inode() already does for files */
642 de->d_flags = (de->d_flags & ~DCACHE_ENTRY_TYPE) |
644 spin_unlock(&de->d_lock);
647 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
648 de, de->d_inode, ll_d_count(de), de->d_flags);
652 static int ll_lookup_it_finish(struct ptlrpc_request *request,
653 struct lookup_intent *it,
654 struct inode *parent, struct dentry **de,
655 void *secctx, __u32 secctxlen,
656 void *encctx, __u32 encctxlen,
657 ktime_t kstart, bool encrypt)
659 struct inode *inode = NULL;
662 struct dentry *alias;
665 /* NB 1 request reference will be taken away by ll_intent_lock()
667 CDEBUG(D_DENTRY, "it %p it_disposition %x\n", it,
669 if (!it_disposition(it, DISP_LOOKUP_NEG)) {
670 struct req_capsule *pill = &request->rq_pill;
671 struct mdt_body *body = req_capsule_server_get(pill,
674 rc = ll_prep_inode(&inode, &request->rq_pill, (*de)->d_sb, it);
678 /* If encryption context was returned by MDT, put it in
679 * inode now to save an extra getxattr and avoid deadlock.
681 if (body->mbo_valid & OBD_MD_ENCCTX) {
682 encctx = req_capsule_server_get(pill, &RMF_FILE_ENCCTX);
683 encctxlen = req_capsule_get_size(pill,
689 "server returned encryption ctx for "DFID"\n",
690 PFID(ll_inode2fid(inode)));
691 rc = ll_xattr_cache_insert(inode,
692 LL_XATTR_NAME_ENCRYPTION_CONTEXT,
695 CWARN("%s: cannot set enc ctx for "DFID": rc = %d\n",
696 ll_i2sbi(inode)->ll_fsname,
697 PFID(ll_inode2fid(inode)), rc);
699 rc = llcrypt_get_encryption_info(inode);
702 "cannot get enc info for "DFID": rc = %d\n",
703 PFID(ll_inode2fid(inode)), rc);
708 ll_set_lock_data(ll_i2sbi(parent)->ll_md_exp, inode, it, &bits);
709 /* OPEN can return data if lock has DoM+LAYOUT bits set */
710 if (it->it_op & IT_OPEN &&
711 bits & MDS_INODELOCK_DOM && bits & MDS_INODELOCK_LAYOUT)
712 ll_dom_finish_open(inode, request);
714 /* We used to query real size from OSTs here, but actually
715 * this is not needed. For stat() calls size would be updated
716 * from subsequent do_revalidate()->ll_inode_revalidate_it() in
718 * vfs_getattr_it->ll_getattr()->ll_inode_revalidate_it() in 2.6
719 * Everybody else who needs correct file size would call
720 * ll_glimpse_size or some equivalent themselves anyway.
724 /* If security context was returned by MDT, put it in
725 * inode now to save an extra getxattr from security hooks,
726 * and avoid deadlock.
728 if (body->mbo_valid & OBD_MD_SECCTX) {
729 secctx = req_capsule_server_get(pill, &RMF_FILE_SECCTX);
730 secctxlen = req_capsule_get_size(pill,
735 CDEBUG(D_SEC, "server returned security context"
737 PFID(ll_inode2fid(inode)));
740 if (secctx != NULL && secctxlen != 0) {
741 /* no need to protect selinux_inode_setsecurity() by
742 * inode_lock. Taking it would lead to a client deadlock
745 rc = security_inode_notifysecctx(inode, secctx,
748 CWARN("%s: cannot set security context for "DFID": rc = %d\n",
749 ll_i2sbi(inode)->ll_fsname,
750 PFID(ll_inode2fid(inode)),
755 /* Only hash *de if it is unhashed (new dentry).
756 * Atoimc_open may passin hashed dentries for open.
758 alias = ll_splice_alias(inode, *de);
760 GOTO(out, rc = PTR_ERR(alias));
764 if (!it_disposition(it, DISP_LOOKUP_NEG)) {
765 /* we have lookup look - unhide dentry */
766 if (bits & MDS_INODELOCK_LOOKUP) {
767 d_lustre_revalidate(*de);
768 ll_update_dir_depth(parent, (*de)->d_inode);
772 rc = llcrypt_get_encryption_info(inode);
775 if (!llcrypt_has_encryption_key(inode))
776 GOTO(out, rc = -ENOKEY);
778 } else if (!it_disposition(it, DISP_OPEN_CREATE)) {
780 * If file was created on the server, the dentry is revalidated
781 * in ll_create_it if the lock allows for it.
783 /* Check that parent has UPDATE lock. */
784 struct lookup_intent parent_it = {
786 .it_lock_handle = 0 };
787 struct lu_fid fid = ll_i2info(parent)->lli_fid;
789 /* If it is striped directory, get the real stripe parent */
790 if (unlikely(ll_dir_striped(parent))) {
791 rc = md_get_fid_from_lsm(ll_i2mdexp(parent),
792 ll_i2info(parent)->lli_lsm_md,
794 (*de)->d_name.len, &fid);
799 if (md_revalidate_lock(ll_i2mdexp(parent), &parent_it, &fid,
801 d_lustre_revalidate(*de);
802 ll_intent_release(&parent_it);
806 if (it_disposition(it, DISP_OPEN_CREATE)) {
807 ll_stats_ops_tally(ll_i2sbi(parent), LPROC_LL_MKNOD,
808 ktime_us_delta(ktime_get(), kstart));
814 if (rc != 0 && it->it_op & IT_OPEN) {
815 ll_intent_drop_lock(it);
816 ll_open_cleanup((*de)->d_sb, &request->rq_pill);
822 static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
823 struct lookup_intent *it,
824 void **secctx, __u32 *secctxlen,
825 struct pcc_create_attach *pca,
827 void **encctx, __u32 *encctxlen)
829 ktime_t kstart = ktime_get();
830 struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
831 struct dentry *save = dentry, *retval;
832 struct ptlrpc_request *req = NULL;
833 struct md_op_data *op_data = NULL;
834 struct lov_user_md *lum = NULL;
837 char secctx_name[XATTR_NAME_MAX + 1];
838 struct llcrypt_name fname;
842 if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen)
843 RETURN(ERR_PTR(-ENAMETOOLONG));
845 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), intent=%s\n",
846 dentry, PFID(ll_inode2fid(parent)), parent, LL_IT2STR(it));
848 if (d_mountpoint(dentry))
849 CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it));
851 if (it == NULL || it->it_op == IT_GETXATTR)
854 if (it->it_op == IT_GETATTR && dentry_may_statahead(parent, dentry)) {
855 rc = ll_revalidate_statahead(parent, &dentry, 0);
857 RETURN(dentry == save ? NULL : dentry);
860 if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
861 dentry->d_sb->s_flags & SB_RDONLY)
862 RETURN(ERR_PTR(-EROFS));
864 if (it->it_op & IT_CREAT)
865 opc = LUSTRE_OPC_CREATE;
867 opc = LUSTRE_OPC_LOOKUP;
869 /* Here we should be calling llcrypt_prepare_lookup(). But it installs a
870 * custom ->d_revalidate() method, so we lose ll_d_ops.
871 * To workaround this, call ll_setup_filename() and do the rest
872 * manually. Also make a copy of llcrypt_d_revalidate() (unfortunately
873 * not exported function) and call it from ll_revalidate_dentry(), to
874 * ensure we do not cache stale dentries after a key has been added.
876 rc = ll_setup_filename(parent, &dentry->d_name, 1, &fname, &fid);
877 if ((!rc || rc == -ENOENT) && fname.is_ciphertext_name) {
878 spin_lock(&dentry->d_lock);
879 dentry->d_flags |= DCACHE_ENCRYPTED_NAME;
880 spin_unlock(&dentry->d_lock);
887 op_data = ll_prep_md_op_data(NULL, parent, NULL, fname.disk_name.name,
888 fname.disk_name.len, 0, opc, NULL);
889 if (IS_ERR(op_data)) {
890 llcrypt_free_filename(&fname);
891 RETURN(ERR_CAST(op_data));
893 if (!fid_is_zero(&fid)) {
894 op_data->op_fid2 = fid;
895 op_data->op_bias = MDS_FID_OP;
896 if (it->it_op & IT_OPEN)
897 it->it_flags |= MDS_OPEN_BY_FID;
900 /* enforce umask if acl disabled or MDS doesn't support umask */
901 if (!IS_POSIXACL(parent) || !exp_connect_umask(ll_i2mdexp(parent)))
902 it->it_create_mode &= ~current_umask();
904 if (it->it_op & IT_CREAT &&
905 test_bit(LL_SBI_FILE_SECCTX, ll_i2sbi(parent)->ll_flags)) {
906 rc = ll_dentry_init_security(dentry, it->it_create_mode,
908 &op_data->op_file_secctx_name,
909 &op_data->op_file_secctx,
910 &op_data->op_file_secctx_size);
912 GOTO(out, retval = ERR_PTR(rc));
914 *secctx = op_data->op_file_secctx;
915 if (secctxlen != NULL)
916 *secctxlen = op_data->op_file_secctx_size;
920 if (secctxlen != NULL)
923 if (it->it_op & IT_CREAT && encrypt) {
924 if (unlikely(filename_is_volatile(dentry->d_name.name,
925 dentry->d_name.len, NULL))) {
926 /* get encryption context from reference file */
927 int ctx_size = LLCRYPT_ENC_CTX_SIZE;
928 struct lustre_sb_info *lsi;
929 struct file *ref_file;
930 struct inode *ref_inode;
933 rc = volatile_ref_file(dentry->d_name.name,
937 GOTO(out, retval = ERR_PTR(rc));
939 ref_inode = file_inode(ref_file);
942 GOTO(inherit, rc = -EINVAL);
945 lsi = s2lsi(ref_inode->i_sb);
948 OBD_ALLOC(ctx, ctx_size);
950 GOTO(out, retval = ERR_PTR(-ENOMEM));
952 #ifdef CONFIG_LL_ENCRYPTION
953 rc = lsi->lsi_cop->get_context(ref_inode,
955 #elif defined(HAVE_LUSTRE_CRYPTO)
956 rc = ref_inode->i_sb->s_cop->get_context(ref_inode,
962 OBD_FREE(ctx, ctx_size);
968 OBD_FREE(ctx, ctx_size);
972 op_data->op_file_encctx_size = rc;
973 if (rc == ctx_size) {
974 op_data->op_file_encctx = ctx;
976 OBD_ALLOC(op_data->op_file_encctx,
977 op_data->op_file_encctx_size);
978 if (!op_data->op_file_encctx) {
979 OBD_FREE(ctx, ctx_size);
980 GOTO(out, retval = ERR_PTR(-ENOMEM));
982 memcpy(op_data->op_file_encctx, ctx,
983 op_data->op_file_encctx_size);
984 OBD_FREE(ctx, ctx_size);
988 rc = llcrypt_inherit_context(parent, NULL, op_data,
991 GOTO(out, retval = ERR_PTR(rc));
994 *encctx = op_data->op_file_encctx;
995 if (encctxlen != NULL)
996 *encctxlen = op_data->op_file_encctx_size;
1000 if (encctxlen != NULL)
1004 /* ask for security context upon intent */
1005 if (it->it_op & (IT_LOOKUP | IT_GETATTR | IT_OPEN)) {
1006 /* get name of security xattr to request to server */
1007 rc = ll_listsecurity(parent, secctx_name,
1008 sizeof(secctx_name));
1010 CDEBUG(D_SEC, "cannot get security xattr name for "
1012 PFID(ll_inode2fid(parent)), rc);
1013 } else if (rc > 0) {
1014 op_data->op_file_secctx_name = secctx_name;
1015 op_data->op_file_secctx_name_size = rc;
1016 CDEBUG(D_SEC, "'%.*s' is security xattr for "DFID"\n",
1017 rc, secctx_name, PFID(ll_inode2fid(parent)));
1021 if (pca && pca->pca_dataset) {
1024 GOTO(out, retval = ERR_PTR(-ENOMEM));
1026 lum->lmm_magic = LOV_USER_MAGIC_V1;
1027 lum->lmm_pattern = LOV_PATTERN_F_RELEASED | LOV_PATTERN_RAID0;
1028 op_data->op_data = lum;
1029 op_data->op_data_size = sizeof(*lum);
1030 op_data->op_archive_id = pca->pca_dataset->pccd_rwid;
1031 it->it_flags |= MDS_OPEN_PCC;
1034 rc = md_intent_lock(ll_i2mdexp(parent), op_data, it, &req,
1035 &ll_md_blocking_ast, 0);
1036 /* If the MDS allows the client to chgrp (CFS_SETGRP_PERM), but the
1037 * client does not know which suppgid should be sent to the MDS, or
1038 * some other(s) changed the target file's GID after this RPC sent
1039 * to the MDS with the suppgid as the original GID, then we should
1040 * try again with right suppgid. */
1041 if (rc == -EACCES && it->it_op & IT_OPEN &&
1042 it_disposition(it, DISP_OPEN_DENY)) {
1043 struct mdt_body *body;
1045 LASSERT(req != NULL);
1047 body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
1048 if (op_data->op_suppgids[0] == body->mbo_gid ||
1049 op_data->op_suppgids[1] == body->mbo_gid ||
1050 !in_group_p(make_kgid(&init_user_ns, body->mbo_gid)))
1051 GOTO(out, retval = ERR_PTR(-EACCES));
1053 fid_zero(&op_data->op_fid2);
1054 op_data->op_suppgids[1] = body->mbo_gid;
1055 ptlrpc_req_finished(req);
1057 ll_intent_release(it);
1058 rc = md_intent_lock(ll_i2mdexp(parent), op_data, it, &req,
1059 &ll_md_blocking_ast, 0);
1063 GOTO(out, retval = ERR_PTR(rc));
1065 if (pca && pca->pca_dataset) {
1066 rc = pcc_inode_create(parent->i_sb, pca->pca_dataset,
1070 GOTO(out, retval = ERR_PTR(rc));
1073 /* dir layout may change */
1074 ll_unlock_md_op_lsm(op_data);
1075 rc = ll_lookup_it_finish(req, it, parent, &dentry,
1076 secctx != NULL ? *secctx : NULL,
1077 secctxlen != NULL ? *secctxlen : 0,
1078 encctx != NULL ? *encctx : NULL,
1079 encctxlen != NULL ? *encctxlen : 0,
1082 ll_intent_release(it);
1083 GOTO(out, retval = ERR_PTR(rc));
1086 if ((it->it_op & IT_OPEN) && dentry->d_inode &&
1087 !S_ISREG(dentry->d_inode->i_mode) &&
1088 !S_ISDIR(dentry->d_inode->i_mode)) {
1089 ll_release_openhandle(dentry, it);
1091 ll_lookup_finish_locks(it, dentry);
1093 GOTO(out, retval = (dentry == save) ? NULL : dentry);
1096 if (op_data != NULL && !IS_ERR(op_data)) {
1097 if (secctx != NULL && secctxlen != NULL) {
1098 /* caller needs sec ctx info, so reset it in op_data to
1099 * prevent it from being freed */
1100 op_data->op_file_secctx = NULL;
1101 op_data->op_file_secctx_size = 0;
1103 if (encctx != NULL && encctxlen != NULL &&
1104 it->it_op & IT_CREAT && encrypt) {
1105 /* caller needs enc ctx info, so reset it in op_data to
1106 * prevent it from being freed
1108 op_data->op_file_encctx = NULL;
1109 op_data->op_file_encctx_size = 0;
1111 llcrypt_free_filename(&fname);
1112 ll_finish_md_op_data(op_data);
1118 ptlrpc_req_finished(req);
1122 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
1125 struct lookup_intent *itp, it = { .it_op = IT_GETATTR };
1128 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), flags=%u\n",
1129 dentry, PFID(ll_inode2fid(parent)), parent, flags);
1132 * Optimize away (CREATE && !OPEN). Let .create handle the race.
1133 * but only if we have write permissions there, otherwise we need
1134 * to proceed with lookup. LU-4185
1136 if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN) &&
1137 (inode_permission(&init_user_ns,
1138 parent, MAY_WRITE | MAY_EXEC) == 0))
1141 if (flags & (LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE))
1145 de = ll_lookup_it(parent, dentry, itp, NULL, NULL, NULL, false,
1149 ll_intent_release(itp);
1154 #ifdef FMODE_CREATED /* added in Linux v4.18-rc1-20-g73a09dd */
1155 # define ll_is_opened(o, f) ((f)->f_mode & FMODE_OPENED)
1156 # define ll_finish_open(f, d, o) finish_open((f), (d), NULL)
1157 # define ll_last_arg
1158 # define ll_set_created(o, f) \
1160 (f)->f_mode |= FMODE_CREATED; \
1164 # define ll_is_opened(o, f) (*(o))
1165 # define ll_finish_open(f, d, o) finish_open((f), (d), NULL, (o))
1166 # define ll_last_arg , int *opened
1167 # define ll_set_created(o, f) \
1169 *(o) |= FILE_CREATED; \
1175 * For cached negative dentry and new dentry, handle lookup/create/open
1178 static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
1179 struct file *file, unsigned open_flags,
1180 umode_t mode ll_last_arg)
1182 struct lookup_intent *it;
1184 long long lookup_flags = LOOKUP_OPEN;
1185 void *secctx = NULL;
1186 __u32 secctxlen = 0;
1187 void *encctx = NULL;
1188 __u32 encctxlen = 0;
1189 struct ll_sb_info *sbi = NULL;
1190 struct pcc_create_attach pca = { NULL, NULL };
1191 bool encrypt = false;
1196 "VFS Op:name=%pd, dir="DFID"(%p), file %p, open_flags %x, mode %x opened %d\n",
1197 dentry, PFID(ll_inode2fid(dir)), dir, file, open_flags, mode,
1198 ll_is_opened(opened, file));
1200 /* Only negative dentries enter here */
1201 LASSERT(dentry->d_inode == NULL);
1203 if (!d_unhashed(dentry)) {
1204 /* A valid negative dentry that just passed revalidation,
1205 * there's little point to try and open it server-side,
1206 * even though there's a minuscule chance it might succeed.
1207 * Either way it's a valid race to just return -ENOENT here.
1209 if (!(open_flags & O_CREAT))
1212 /* Otherwise we just unhash it to be rehashed afresh via
1213 * lookup if necessary
1218 OBD_ALLOC(it, sizeof(*it));
1222 it->it_op = IT_OPEN;
1223 if (open_flags & O_CREAT) {
1224 it->it_op |= IT_CREAT;
1225 lookup_flags |= LOOKUP_CREATE;
1226 sbi = ll_i2sbi(dir);
1227 /* Volatile file is used for HSM restore, so do not use PCC */
1228 if (!filename_is_volatile(dentry->d_name.name,
1229 dentry->d_name.len, NULL)) {
1230 struct pcc_matcher item;
1231 struct pcc_dataset *dataset;
1233 item.pm_uid = from_kuid(&init_user_ns, current_uid());
1234 item.pm_gid = from_kgid(&init_user_ns, current_gid());
1235 item.pm_projid = ll_i2info(dir)->lli_projid;
1236 item.pm_name = &dentry->d_name;
1237 dataset = pcc_dataset_match_get(&sbi->ll_pcc_super,
1239 pca.pca_dataset = dataset;
1242 it->it_create_mode = (mode & S_IALLUGO) | S_IFREG;
1243 it->it_flags = (open_flags & ~O_ACCMODE) | OPEN_FMODE(open_flags);
1244 it->it_flags &= ~MDS_OPEN_FL_INTERNAL;
1246 if (ll_sbi_has_encrypt(ll_i2sbi(dir)) && IS_ENCRYPTED(dir)) {
1247 /* in case of create, this is going to be a regular file because
1248 * we set S_IFREG bit on it->it_create_mode above
1250 rc = llcrypt_get_encryption_info(dir);
1252 GOTO(out_release, rc);
1253 if (open_flags & O_CREAT) {
1254 /* For migration or mirroring without enc key, we still
1255 * need to be able to create a volatile file.
1257 if (!llcrypt_has_encryption_key(dir) &&
1258 (!filename_is_volatile(dentry->d_name.name,
1259 dentry->d_name.len, NULL) ||
1260 (open_flags & O_FILE_ENC) != O_FILE_ENC ||
1261 !(open_flags & O_DIRECT)))
1262 GOTO(out_release, rc = -ENOKEY);
1267 OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE2, cfs_fail_val);
1269 /* We can only arrive at this path when we have no inode, so
1270 * we only need to request open lock if it was requested
1273 if (ll_i2sbi(dir)->ll_oc_thrsh_count == 1 &&
1274 exp_connect_flags2(ll_i2mdexp(dir)) &
1275 OBD_CONNECT2_ATOMIC_OPEN_LOCK)
1276 it->it_flags |= MDS_OPEN_LOCK;
1278 /* Dentry added to dcache tree in ll_lookup_it */
1279 de = ll_lookup_it(dir, dentry, it, &secctx, &secctxlen, &pca, encrypt,
1280 &encctx, &encctxlen);
1283 else if (de != NULL)
1286 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val);
1289 if (it_disposition(it, DISP_OPEN_CREATE)) {
1290 /* Dentry instantiated in ll_create_it. */
1291 rc = ll_create_it(dir, dentry, it, secctx, secctxlen,
1292 encrypt, encctx, encctxlen,
1294 ll_security_release_secctx(secctx, secctxlen);
1295 llcrypt_free_ctx(encctx, encctxlen);
1297 /* We dget in ll_splice_alias. */
1303 rc = pcc_inode_create_fini(dentry->d_inode, &pca);
1307 GOTO(out_release, rc);
1310 ll_set_created(opened, file);
1312 /* Open the file with O_CREAT, but the file already
1313 * existed on MDT. This may happend in the case that
1314 * the LOOKUP ibits lock is revoked and the
1315 * corresponding dentry cache is deleted.
1316 * i.e. In the current Lustre, the truncate operation
1317 * will revoke the LOOKUP ibits lock, and the file
1318 * dentry cache will be invalidated. The following open
1319 * with O_CREAT flag will call into ->atomic_open, the
1320 * file was wrongly though as newly created file and
1321 * try to auto cache the file. So after client knows it
1322 * is not a DISP_OPEN_CREATE, it should cleanup the
1323 * already created PCC copy.
1325 pcc_create_attach_cleanup(dir->i_sb, &pca);
1327 if (open_flags & O_CREAT && encrypt &&
1329 rc = ll_set_encflags(dentry->d_inode, encctx,
1331 llcrypt_free_ctx(encctx, encctxlen);
1333 GOTO(out_release, rc);
1337 /* check also if a foreign file is openable */
1338 if (dentry->d_inode && it_disposition(it, DISP_OPEN_OPEN) &&
1339 ll_foreign_is_openable(dentry, open_flags)) {
1341 if (S_ISFIFO(dentry->d_inode->i_mode)) {
1342 /* We cannot call open here as it might
1343 * deadlock. This case is unreachable in
1344 * practice because of OBD_CONNECT_NODEVOH. */
1345 rc = finish_no_open(file, de);
1347 file->private_data = it;
1348 rc = ll_finish_open(file, dentry, opened);
1349 /* We dget in ll_splice_alias. finish_open takes
1350 * care of dget for fd open.
1356 rc = finish_no_open(file, de);
1359 pcc_create_attach_cleanup(dir->i_sb, &pca);
1363 ll_intent_release(it);
1364 OBD_FREE(it, sizeof(*it));
1369 /* We depend on "mode" being set with the proper file type/umask by now */
1370 static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)
1372 struct inode *inode = NULL;
1373 struct ptlrpc_request *request = NULL;
1374 struct ll_sb_info *sbi = ll_i2sbi(dir);
1378 LASSERT(it && it->it_disposition);
1380 LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF));
1381 request = it->it_request;
1382 it_clear_disposition(it, DISP_ENQ_CREATE_REF);
1383 rc = ll_prep_inode(&inode, &request->rq_pill, dir->i_sb, it);
1385 GOTO(out, inode = ERR_PTR(rc));
1387 /* Pause to allow for a race with concurrent access by fid */
1388 OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_NODE_PAUSE, cfs_fail_val);
1390 /* We asked for a lock on the directory, but were granted a
1391 * lock on the inode. Since we finally have an inode pointer,
1392 * stuff it in the lock. */
1393 CDEBUG(D_DLMTRACE, "setting l_ast_data to inode "DFID"(%p)\n",
1394 PFID(ll_inode2fid(inode)), inode);
1395 ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL);
1398 ptlrpc_req_finished(request);
1403 * By the time this is called, we already have created the directory cache
1404 * entry for the new file, but it is so far negative - it has no inode.
1406 * We defer creating the OBD object(s) until open, to keep the intent and
1407 * non-intent code paths similar, and also because we do not have the MDS
1408 * inode number before calling ll_create_node() (which is needed for LOV),
1409 * so we would need to do yet another RPC to the MDS to store the LOV EA
1410 * data on the MDS. If needed, we would pass the PACKED lmm as data and
1411 * lmm_size in datalen (the MDS still has code which will handle that).
1413 * If the create succeeds, we fill in the inode information
1414 * with d_instantiate().
1416 static int ll_create_it(struct inode *dir, struct dentry *dentry,
1417 struct lookup_intent *it,
1418 void *secctx, __u32 secctxlen, bool encrypt,
1419 void *encctx, __u32 encctxlen, unsigned int open_flags)
1421 struct inode *inode;
1426 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), intent=%s\n",
1427 dentry, PFID(ll_inode2fid(dir)), dir, LL_IT2STR(it));
1429 rc = it_open_error(DISP_OPEN_CREATE, it);
1433 inode = ll_create_node(dir, it);
1435 RETURN(PTR_ERR(inode));
1437 if (test_bit(LL_SBI_FILE_SECCTX, ll_i2sbi(inode)->ll_flags) &&
1439 /* must be done before d_instantiate, because it calls
1440 * security_d_instantiate, which means a getxattr if security
1441 * context is not set yet */
1442 /* no need to protect selinux_inode_setsecurity() by
1443 * inode_lock. Taking it would lead to a client deadlock
1446 rc = security_inode_notifysecctx(inode, secctx, secctxlen);
1451 d_instantiate(dentry, inode);
1454 bool preload = true;
1456 /* For migration or mirroring without enc key, we
1457 * create a volatile file without enc context.
1459 if (!llcrypt_has_encryption_key(dir) &&
1460 filename_is_volatile(dentry->d_name.name,
1461 dentry->d_name.len, NULL) &&
1462 (open_flags & O_FILE_ENC) == O_FILE_ENC &&
1463 open_flags & O_DIRECT)
1465 rc = ll_set_encflags(inode, encctx, encctxlen, preload);
1470 if (!test_bit(LL_SBI_FILE_SECCTX, ll_i2sbi(inode)->ll_flags)) {
1471 rc = ll_inode_init_security(dentry, inode, dir);
1476 ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, inode, it, &bits);
1477 if (bits & MDS_INODELOCK_LOOKUP) {
1478 d_lustre_revalidate(dentry);
1479 ll_update_dir_depth(dir, inode);
1485 void ll_update_times(struct ptlrpc_request *request, struct inode *inode)
1487 struct mdt_body *body = req_capsule_server_get(&request->rq_pill,
1491 if (body->mbo_valid & OBD_MD_FLMTIME &&
1492 body->mbo_mtime > inode->i_mtime.tv_sec) {
1494 "setting fid " DFID " mtime from %lld to %llu\n",
1495 PFID(ll_inode2fid(inode)),
1496 (s64)inode->i_mtime.tv_sec, body->mbo_mtime);
1497 inode->i_mtime.tv_sec = body->mbo_mtime;
1500 if (body->mbo_valid & OBD_MD_FLCTIME &&
1501 body->mbo_ctime > inode->i_ctime.tv_sec)
1502 inode->i_ctime.tv_sec = body->mbo_ctime;
1505 /* once default LMV (space balanced) is set on ROOT, it should take effect if
1506 * default LMV is not set on parent directory.
1508 static void ll_qos_mkdir_prep(struct md_op_data *op_data, struct inode *dir)
1510 struct inode *root = dir->i_sb->s_root->d_inode;
1511 struct ll_inode_info *rlli = ll_i2info(root);
1512 struct ll_inode_info *lli = ll_i2info(dir);
1513 struct lmv_stripe_md *lsm;
1515 op_data->op_dir_depth = lli->lli_dir_depth;
1517 /* parent directory is striped */
1518 if (unlikely(lli->lli_lsm_md))
1521 /* default LMV set on parent directory */
1522 if (unlikely(lli->lli_default_lsm_md))
1525 /* parent is ROOT */
1526 if (unlikely(dir == root))
1529 /* default LMV not set on ROOT */
1530 if (!rlli->lli_default_lsm_md)
1533 down_read(&rlli->lli_lsm_sem);
1534 lsm = rlli->lli_default_lsm_md;
1538 /* not space balanced */
1539 if (lsm->lsm_md_master_mdt_index != LMV_OFFSET_DEFAULT)
1542 if (lsm->lsm_md_max_inherit != LMV_INHERIT_NONE &&
1543 (lsm->lsm_md_max_inherit == LMV_INHERIT_UNLIMITED ||
1544 lsm->lsm_md_max_inherit >= lli->lli_dir_depth)) {
1545 op_data->op_flags |= MF_QOS_MKDIR;
1546 if (lsm->lsm_md_max_inherit_rr != LMV_INHERIT_RR_NONE &&
1547 (lsm->lsm_md_max_inherit_rr == LMV_INHERIT_RR_UNLIMITED ||
1548 lsm->lsm_md_max_inherit_rr >= lli->lli_dir_depth))
1549 op_data->op_flags |= MF_RR_MKDIR;
1550 CDEBUG(D_INODE, DFID" requests qos mkdir %#x\n",
1551 PFID(&lli->lli_fid), op_data->op_flags);
1554 up_read(&rlli->lli_lsm_sem);
1557 static int ll_new_node(struct inode *dir, struct dentry *dchild,
1558 const char *tgt, umode_t mode, __u64 rdev, __u32 opc)
1560 struct qstr *name = &dchild->d_name;
1561 struct ptlrpc_request *request = NULL;
1562 struct md_op_data *op_data = NULL;
1563 struct inode *inode = NULL;
1564 struct ll_sb_info *sbi = ll_i2sbi(dir);
1565 struct llcrypt_str *disk_link = NULL;
1566 bool encrypt = false;
1570 if (unlikely(tgt != NULL)) {
1571 disk_link = (struct llcrypt_str *)rdev;
1578 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
1579 name->len, 0, opc, NULL);
1580 if (IS_ERR(op_data))
1581 GOTO(err_exit, err = PTR_ERR(op_data));
1584 ll_qos_mkdir_prep(op_data, dir);
1586 if (test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) {
1587 err = ll_dentry_init_security(dchild, mode, &dchild->d_name,
1588 &op_data->op_file_secctx_name,
1589 &op_data->op_file_secctx,
1590 &op_data->op_file_secctx_size);
1592 GOTO(err_exit, err);
1595 if (ll_sbi_has_encrypt(sbi) &&
1596 ((IS_ENCRYPTED(dir) &&
1597 (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) ||
1598 (unlikely(llcrypt_dummy_context_enabled(dir)) && S_ISDIR(mode)))) {
1599 err = llcrypt_get_encryption_info(dir);
1601 GOTO(err_exit, err);
1602 if (!llcrypt_has_encryption_key(dir))
1603 GOTO(err_exit, err = -ENOKEY);
1608 err = llcrypt_inherit_context(dir, NULL, op_data, false);
1610 GOTO(err_exit, err);
1612 if (S_ISLNK(mode)) {
1613 /* llcrypt needs inode to encrypt target name, so create
1614 * a fake inode and associate encryption context got
1615 * from llcrypt_inherit_context.
1617 struct inode *fakeinode =
1618 dchild->d_sb->s_op->alloc_inode(dchild->d_sb);
1621 GOTO(err_exit, err = -ENOMEM);
1622 fakeinode->i_sb = dchild->d_sb;
1623 fakeinode->i_mode |= S_IFLNK;
1625 fakeinode->i_opflags |= IOP_XATTR;
1627 ll_lli_init(ll_i2info(fakeinode));
1628 err = ll_set_encflags(fakeinode,
1629 op_data->op_file_encctx,
1630 op_data->op_file_encctx_size,
1633 err = __llcrypt_encrypt_symlink(fakeinode, tgt,
1637 ll_xattr_cache_destroy(fakeinode);
1638 llcrypt_put_encryption_info(fakeinode);
1639 dchild->d_sb->s_op->destroy_inode(fakeinode);
1641 GOTO(err_exit, err);
1645 err = md_create(sbi->ll_md_exp, op_data, tgt ? disk_link->name : NULL,
1646 tgt ? disk_link->len : 0, mode,
1647 from_kuid(&init_user_ns, current_fsuid()),
1648 from_kgid(&init_user_ns, current_fsgid()),
1649 current_cap(), rdev, &request);
1650 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 15, 58, 0)
1652 * server < 2.12.58 doesn't pack default LMV in intent_getattr reply,
1653 * fetch default LMV here.
1655 if (unlikely(err == -EREMOTE)) {
1656 struct ll_inode_info *lli = ll_i2info(dir);
1657 struct lmv_user_md *lum;
1661 ptlrpc_req_finished(request);
1663 ll_finish_md_op_data(op_data);
1666 err2 = ll_dir_getstripe(dir, (void **)&lum, &lumsize, &request,
1667 OBD_MD_DEFAULT_MEA);
1669 struct lustre_md md = { NULL };
1671 md.body = req_capsule_server_get(&request->rq_pill,
1674 GOTO(err_exit, err = -EPROTO);
1676 OBD_ALLOC_PTR(md.default_lmv);
1677 if (!md.default_lmv)
1678 GOTO(err_exit, err = -ENOMEM);
1680 md.default_lmv->lsm_md_magic = lum->lum_magic;
1681 md.default_lmv->lsm_md_stripe_count =
1682 lum->lum_stripe_count;
1683 md.default_lmv->lsm_md_master_mdt_index =
1684 lum->lum_stripe_offset;
1685 md.default_lmv->lsm_md_hash_type = lum->lum_hash_type;
1686 md.default_lmv->lsm_md_max_inherit =
1687 lum->lum_max_inherit;
1688 md.default_lmv->lsm_md_max_inherit_rr =
1689 lum->lum_max_inherit_rr;
1691 err = ll_update_inode(dir, &md);
1692 md_free_lustre_md(sbi->ll_md_exp, &md);
1694 GOTO(err_exit, err);
1695 } else if (err2 == -ENODATA && lli->lli_default_lsm_md) {
1697 * If there are no default stripe EA on the MDT, but the
1698 * client has default stripe, then it probably means
1699 * default stripe EA has just been deleted.
1701 down_write(&lli->lli_lsm_sem);
1702 if (lli->lli_default_lsm_md)
1703 OBD_FREE_PTR(lli->lli_default_lsm_md);
1704 lli->lli_default_lsm_md = NULL;
1705 up_write(&lli->lli_lsm_sem);
1707 GOTO(err_exit, err);
1710 ptlrpc_req_finished(request);
1717 GOTO(err_exit, err);
1719 ll_update_times(request, dir);
1721 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_NEWNODE_PAUSE, cfs_fail_val);
1723 err = ll_prep_inode(&inode, &request->rq_pill, dchild->d_sb, NULL);
1725 GOTO(err_exit, err);
1727 if (test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) {
1728 /* must be done before d_instantiate, because it calls
1729 * security_d_instantiate, which means a getxattr if security
1730 * context is not set yet */
1731 /* no need to protect selinux_inode_setsecurity() by
1732 * inode_lock. Taking it would lead to a client deadlock
1735 err = security_inode_notifysecctx(inode,
1736 op_data->op_file_secctx,
1737 op_data->op_file_secctx_size);
1739 GOTO(err_exit, err);
1742 d_instantiate(dchild, inode);
1745 err = ll_set_encflags(inode, op_data->op_file_encctx,
1746 op_data->op_file_encctx_size, true);
1748 GOTO(err_exit, err);
1750 if (S_ISLNK(mode)) {
1751 struct ll_inode_info *lli = ll_i2info(inode);
1753 /* Cache the plaintext symlink target
1754 * for later use by get_link()
1756 OBD_ALLOC(lli->lli_symlink_name, strlen(tgt) + 1);
1757 /* do not return an error if we cannot
1758 * cache the symlink locally
1760 if (lli->lli_symlink_name)
1761 memcpy(lli->lli_symlink_name,
1762 tgt, strlen(tgt) + 1);
1766 if (!test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) {
1767 err = ll_inode_init_security(dchild, inode, dir);
1769 GOTO(err_exit, err);
1774 if (request != NULL)
1775 ptlrpc_req_finished(request);
1777 if (!IS_ERR_OR_NULL(op_data))
1778 ll_finish_md_op_data(op_data);
1783 static int ll_mknod(struct user_namespace *mnt_userns, struct inode *dir,
1784 struct dentry *dchild, umode_t mode, dev_t rdev)
1786 ktime_t kstart = ktime_get();
1790 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p) mode %o dev %x\n",
1791 dchild, PFID(ll_inode2fid(dir)), dir, mode, rdev);
1793 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
1794 mode &= ~current_umask();
1796 switch (mode & S_IFMT) {
1805 err = ll_new_node(dir, dchild, NULL, mode, old_encode_dev(rdev),
1816 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKNOD,
1817 ktime_us_delta(ktime_get(), kstart));
1823 * Plain create. Intent create is handled in atomic_open.
1825 static int ll_create_nd(struct user_namespace *mnt_userns,
1826 struct inode *dir, struct dentry *dentry,
1827 umode_t mode, bool want_excl)
1829 ktime_t kstart = ktime_get();
1832 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val);
1835 "VFS Op:name=%pd, dir="DFID"(%p), flags=%u, excl=%d\n",
1836 dentry, PFID(ll_inode2fid(dir)), dir, mode, want_excl);
1838 /* Using mknod(2) to create a regular file is designed to not recognize
1839 * volatile file name, so we use ll_mknod() here. */
1840 rc = ll_mknod(mnt_userns, dir, dentry, mode, 0);
1842 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, unhashed %d\n",
1843 dentry, d_unhashed(dentry));
1846 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE,
1847 ktime_us_delta(ktime_get(), kstart));
1852 static int ll_symlink(struct user_namespace *mnt_userns, struct inode *dir,
1853 struct dentry *dchild, const char *oldpath)
1855 ktime_t kstart = ktime_get();
1856 int len = strlen(oldpath);
1857 struct llcrypt_str disk_link;
1861 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), target=%.*s\n",
1862 dchild, PFID(ll_inode2fid(dir)), dir, 3000, oldpath);
1864 err = llcrypt_prepare_symlink(dir, oldpath, len, dir->i_sb->s_blocksize,
1869 err = ll_new_node(dir, dchild, oldpath, S_IFLNK | S_IRWXUGO,
1870 (__u64)&disk_link, LUSTRE_OPC_SYMLINK);
1872 if (disk_link.name != (unsigned char *)oldpath)
1873 kfree(disk_link.name);
1876 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK,
1877 ktime_us_delta(ktime_get(), kstart));
1882 static int ll_link(struct dentry *old_dentry, struct inode *dir,
1883 struct dentry *new_dentry)
1885 struct inode *src = old_dentry->d_inode;
1886 struct qstr *name = &new_dentry->d_name;
1887 struct ll_sb_info *sbi = ll_i2sbi(dir);
1888 struct ptlrpc_request *request = NULL;
1889 struct md_op_data *op_data;
1890 ktime_t kstart = ktime_get();
1895 "VFS Op: inode="DFID"(%p), dir="DFID"(%p), target=%pd\n",
1896 PFID(ll_inode2fid(src)), src,
1897 PFID(ll_inode2fid(dir)), dir, new_dentry);
1899 err = llcrypt_prepare_link(old_dentry, dir, new_dentry);
1903 op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len,
1904 0, LUSTRE_OPC_ANY, NULL);
1905 if (IS_ERR(op_data))
1906 RETURN(PTR_ERR(op_data));
1908 err = md_link(sbi->ll_md_exp, op_data, &request);
1909 ll_finish_md_op_data(op_data);
1913 ll_update_times(request, dir);
1914 ll_stats_ops_tally(sbi, LPROC_LL_LINK,
1915 ktime_us_delta(ktime_get(), kstart));
1918 ptlrpc_req_finished(request);
1922 static int ll_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
1923 struct dentry *dchild, umode_t mode)
1925 ktime_t kstart = ktime_get();
1929 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p)\n",
1930 dchild, PFID(ll_inode2fid(dir)), dir);
1932 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
1933 mode &= ~current_umask();
1935 mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR;
1937 err = ll_new_node(dir, dchild, NULL, mode, 0, LUSTRE_OPC_MKDIR);
1939 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR,
1940 ktime_us_delta(ktime_get(), kstart));
1945 static int ll_rmdir(struct inode *dir, struct dentry *dchild)
1947 struct qstr *name = &dchild->d_name;
1948 struct ptlrpc_request *request = NULL;
1949 struct md_op_data *op_data;
1950 ktime_t kstart = ktime_get();
1955 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p)\n",
1956 dchild, PFID(ll_inode2fid(dir)), dir);
1958 if (unlikely(d_mountpoint(dchild)))
1961 /* some foreign dir may not be allowed to be removed */
1962 if (!ll_foreign_is_removable(dchild, false))
1965 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len,
1966 S_IFDIR, LUSTRE_OPC_ANY, NULL);
1967 if (IS_ERR(op_data))
1968 RETURN(PTR_ERR(op_data));
1970 if (dchild->d_inode != NULL)
1971 op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
1973 if (fid_is_zero(&op_data->op_fid2))
1974 op_data->op_fid2 = op_data->op_fid3;
1975 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1976 ll_finish_md_op_data(op_data);
1978 struct mdt_body *body;
1980 ll_update_times(request, dir);
1981 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR,
1982 ktime_us_delta(ktime_get(), kstart));
1985 * The server puts attributes in on the last unlink, use them
1986 * to update the link count so the inode can be freed
1989 body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
1990 if (body->mbo_valid & OBD_MD_FLNLINK) {
1991 spin_lock(&dchild->d_inode->i_lock);
1992 set_nlink(dchild->d_inode, body->mbo_nlink);
1993 spin_unlock(&dchild->d_inode->i_lock);
1997 ptlrpc_req_finished(request);
2005 int ll_rmdir_entry(struct inode *dir, char *name, int namelen)
2007 struct ptlrpc_request *request = NULL;
2008 struct md_op_data *op_data;
2009 ktime_t kstart = ktime_get();
2013 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p)\n",
2014 namelen, name, PFID(ll_inode2fid(dir)), dir);
2016 op_data = ll_prep_md_op_data(NULL, dir, NULL, name, strlen(name),
2017 S_IFDIR, LUSTRE_OPC_ANY, NULL);
2018 if (IS_ERR(op_data))
2019 RETURN(PTR_ERR(op_data));
2020 op_data->op_cli_flags |= CLI_RM_ENTRY;
2021 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
2022 ll_finish_md_op_data(op_data);
2024 ll_update_times(request, dir);
2026 ptlrpc_req_finished(request);
2028 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR,
2029 ktime_us_delta(ktime_get(), kstart));
2033 static int ll_unlink(struct inode *dir, struct dentry *dchild)
2035 struct qstr *name = &dchild->d_name;
2036 struct ptlrpc_request *request = NULL;
2037 struct md_op_data *op_data;
2038 struct mdt_body *body;
2039 ktime_t kstart = ktime_get();
2044 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p)\n",
2045 dchild, PFID(ll_inode2fid(dir)), dir);
2048 * XXX: unlink bind mountpoint maybe call to here,
2049 * just check it as vfs_unlink does.
2051 if (unlikely(d_mountpoint(dchild)))
2054 /* some foreign file/dir may not be allowed to be unlinked */
2055 if (!ll_foreign_is_removable(dchild, false))
2058 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len, 0,
2059 LUSTRE_OPC_ANY, NULL);
2060 if (IS_ERR(op_data))
2061 RETURN(PTR_ERR(op_data));
2063 op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
2064 /* notify lower layer if inode has dirty pages */
2065 if (S_ISREG(dchild->d_inode->i_mode) &&
2066 ll_i2info(dchild->d_inode)->lli_clob &&
2067 dirty_cnt(dchild->d_inode))
2068 op_data->op_cli_flags |= CLI_DIRTY_DATA;
2069 if (fid_is_zero(&op_data->op_fid2))
2070 op_data->op_fid2 = op_data->op_fid3;
2071 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
2072 ll_finish_md_op_data(op_data);
2077 * The server puts attributes in on the last unlink, use them to update
2078 * the link count so the inode can be freed immediately.
2080 body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
2081 if (body->mbo_valid & OBD_MD_FLNLINK) {
2082 spin_lock(&dchild->d_inode->i_lock);
2083 set_nlink(dchild->d_inode, body->mbo_nlink);
2084 spin_unlock(&dchild->d_inode->i_lock);
2087 ll_update_times(request, dir);
2090 ptlrpc_req_finished(request);
2092 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK,
2093 ktime_us_delta(ktime_get(), kstart));
2097 static int ll_rename(struct user_namespace *mnt_userns,
2098 struct inode *src, struct dentry *src_dchild,
2099 struct inode *tgt, struct dentry *tgt_dchild
2100 #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_IOPS_RENAME_WITH_FLAGS)
2101 , unsigned int flags
2105 struct ptlrpc_request *request = NULL;
2106 struct ll_sb_info *sbi = ll_i2sbi(src);
2107 struct md_op_data *op_data;
2108 ktime_t kstart = ktime_get();
2110 struct llcrypt_name foldname, fnewname;
2114 #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_IOPS_RENAME_WITH_FLAGS)
2120 "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n",
2121 src_dchild, PFID(ll_inode2fid(src)), src,
2122 tgt_dchild, PFID(ll_inode2fid(tgt)), tgt);
2124 if (unlikely(d_mountpoint(src_dchild) || d_mountpoint(tgt_dchild)))
2127 #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_IOPS_RENAME_WITH_FLAGS)
2128 err = llcrypt_prepare_rename(src, src_dchild, tgt, tgt_dchild, flags);
2130 err = llcrypt_prepare_rename(src, src_dchild, tgt, tgt_dchild, 0);
2134 /* we prevent an encrypted file from being renamed
2135 * into an unencrypted dir
2137 if (IS_ENCRYPTED(src) && !IS_ENCRYPTED(tgt))
2140 if (src_dchild->d_inode)
2141 mode = src_dchild->d_inode->i_mode;
2143 if (tgt_dchild->d_inode)
2144 mode = tgt_dchild->d_inode->i_mode;
2146 op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, mode,
2147 LUSTRE_OPC_ANY, NULL);
2148 if (IS_ERR(op_data))
2149 RETURN(PTR_ERR(op_data));
2151 /* If the client is using a subdir mount and does a rename to what it
2152 * sees as /.fscrypt, interpret it as the .fscrypt dir at fs root.
2154 if (unlikely(is_root_inode(tgt) && !fid_is_root(ll_inode2fid(tgt)) &&
2155 tgt_dchild->d_name.len == strlen(dot_fscrypt_name) &&
2156 strncmp(tgt_dchild->d_name.name, dot_fscrypt_name,
2157 tgt_dchild->d_name.len) == 0))
2158 lu_root_fid(&op_data->op_fid2);
2160 if (src_dchild->d_inode)
2161 op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
2163 if (tgt_dchild->d_inode)
2164 op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
2166 err = ll_setup_filename(src, &src_dchild->d_name, 1, &foldname, NULL);
2169 err = ll_setup_filename(tgt, &tgt_dchild->d_name, 1, &fnewname, NULL);
2171 llcrypt_free_filename(&foldname);
2174 err = md_rename(sbi->ll_md_exp, op_data,
2175 foldname.disk_name.name, foldname.disk_name.len,
2176 fnewname.disk_name.name, fnewname.disk_name.len,
2178 llcrypt_free_filename(&foldname);
2179 llcrypt_free_filename(&fnewname);
2180 ll_finish_md_op_data(op_data);
2182 ll_update_times(request, src);
2183 ll_update_times(request, tgt);
2186 ptlrpc_req_finished(request);
2189 d_move(src_dchild, tgt_dchild);
2190 ll_stats_ops_tally(sbi, LPROC_LL_RENAME,
2191 ktime_us_delta(ktime_get(), kstart));
2197 const struct inode_operations ll_dir_inode_operations = {
2199 .atomic_open = ll_atomic_open,
2200 .lookup = ll_lookup_nd,
2201 .create = ll_create_nd,
2202 /* We need all these non-raw things for NFSD, to not patch it. */
2203 .unlink = ll_unlink,
2206 .symlink = ll_symlink,
2208 .rename = ll_rename,
2209 .setattr = ll_setattr,
2210 .getattr = ll_getattr,
2211 .permission = ll_inode_permission,
2212 #ifdef HAVE_IOP_XATTR
2213 .setxattr = ll_setxattr,
2214 .getxattr = ll_getxattr,
2215 .removexattr = ll_removexattr,
2217 .listxattr = ll_listxattr,
2218 .get_acl = ll_get_acl,
2219 #ifdef HAVE_IOP_SET_ACL
2220 .set_acl = ll_set_acl,
2224 const struct inode_operations ll_special_inode_operations = {
2225 .setattr = ll_setattr,
2226 .getattr = ll_getattr,
2227 .permission = ll_inode_permission,
2228 #ifdef HAVE_IOP_XATTR
2229 .setxattr = ll_setxattr,
2230 .getxattr = ll_getxattr,
2231 .removexattr = ll_removexattr,
2233 .listxattr = ll_listxattr,
2234 .get_acl = ll_get_acl,
2235 #ifdef HAVE_IOP_SET_ACL
2236 .set_acl = ll_set_acl,