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, 2016, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
34 #include <linux/sched.h>
36 #include <linux/quotaops.h>
37 #include <linux/highmem.h>
38 #include <linux/pagemap.h>
39 #include <linux/security.h>
40 #include <linux/user_namespace.h>
41 #ifdef HAVE_UIDGID_HEADER
42 # include <linux/uidgid.h>
45 #define DEBUG_SUBSYSTEM S_LLITE
47 #include <obd_support.h>
48 #include <lustre_fid.h>
49 #include <lustre_dlm.h>
50 #include "llite_internal.h"
52 static int ll_create_it(struct inode *dir, struct dentry *dentry,
53 struct lookup_intent *it,
54 void *secctx, __u32 secctxlen);
56 /* called from iget5_locked->find_inode() under inode_lock spinlock */
57 static int ll_test_inode(struct inode *inode, void *opaque)
59 struct ll_inode_info *lli = ll_i2info(inode);
60 struct lustre_md *md = opaque;
62 if (unlikely(!(md->body->mbo_valid & OBD_MD_FLID))) {
63 CERROR("MDS body missing FID\n");
67 if (!lu_fid_eq(&lli->lli_fid, &md->body->mbo_fid1))
73 static int ll_set_inode(struct inode *inode, void *opaque)
75 struct ll_inode_info *lli = ll_i2info(inode);
76 struct mdt_body *body = ((struct lustre_md *)opaque)->body;
78 if (unlikely(!(body->mbo_valid & OBD_MD_FLID))) {
79 CERROR("MDS body missing FID\n");
83 lli->lli_fid = body->mbo_fid1;
84 if (unlikely(!(body->mbo_valid & OBD_MD_FLTYPE))) {
85 CERROR("Can not initialize inode "DFID" without object type: "
87 PFID(&lli->lli_fid), body->mbo_valid);
91 inode->i_mode = (inode->i_mode & ~S_IFMT) | (body->mbo_mode & S_IFMT);
92 if (unlikely(inode->i_mode == 0)) {
93 CERROR("Invalid inode "DFID" type\n", PFID(&lli->lli_fid));
104 * Get an inode by inode number(@hash), which is already instantiated by
105 * the intent lookup).
107 struct inode *ll_iget(struct super_block *sb, ino_t hash,
108 struct lustre_md *md)
116 inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md);
118 RETURN(ERR_PTR(-ENOMEM));
120 if (inode->i_state & I_NEW) {
121 rc = ll_read_inode2(inode, md);
122 if (rc == 0 && S_ISREG(inode->i_mode) &&
123 ll_i2info(inode)->lli_clob == NULL)
124 rc = cl_file_inode_init(inode, md);
127 /* Let's clear directory lsm here, otherwise
128 * make_bad_inode() will reset the inode mode
129 * to regular, then ll_clear_inode will not
130 * be able to clear lsm_md */
131 if (S_ISDIR(inode->i_mode))
132 ll_dir_clear_lsm_md(inode);
133 make_bad_inode(inode);
134 unlock_new_inode(inode);
138 inode_has_no_xattr(inode);
139 unlock_new_inode(inode);
141 } else if (is_bad_inode(inode)) {
143 inode = ERR_PTR(-ESTALE);
144 } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) {
145 rc = ll_update_inode(inode, md);
146 CDEBUG(D_VFSTRACE, "got inode: "DFID"(%p): rc = %d\n",
147 PFID(&md->body->mbo_fid1), inode, rc);
149 if (S_ISDIR(inode->i_mode))
150 ll_dir_clear_lsm_md(inode);
159 static void ll_invalidate_negative_children(struct inode *dir)
161 struct dentry *dentry, *tmp_subdir;
162 DECLARE_LL_D_HLIST_NODE_PTR(p);
165 ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry) {
166 spin_lock(&dentry->d_lock);
167 if (!list_empty(&dentry->d_subdirs)) {
168 struct dentry *child;
170 list_for_each_entry_safe(child, tmp_subdir,
173 if (child->d_inode == NULL)
174 d_lustre_invalidate(child, 1);
177 spin_unlock(&dentry->d_lock);
179 ll_unlock_dcache(dir);
182 int ll_test_inode_by_fid(struct inode *inode, void *opaque)
184 return lu_fid_eq(&ll_i2info(inode)->lli_fid, opaque);
187 int ll_dom_lock_cancel(struct inode *inode, struct ldlm_lock *lock)
190 struct ll_inode_info *lli = ll_i2info(inode);
191 struct cl_layout clt = { .cl_layout_gen = 0, };
201 env = cl_env_get(&refcheck);
203 RETURN(PTR_ERR(env));
205 rc = cl_object_layout_get(env, lli->lli_clob, &clt);
207 CDEBUG(D_INODE, "Cannot get layout for "DFID"\n",
208 PFID(ll_inode2fid(inode)));
210 } else if (clt.cl_dom_comp_size == 0) {
211 CDEBUG(D_INODE, "DOM lock without DOM layout for "DFID"\n",
212 PFID(ll_inode2fid(inode)));
215 enum cl_fsync_mode mode;
216 loff_t end = clt.cl_dom_comp_size - 1;
218 mode = ldlm_is_discard_data(lock) ?
219 CL_FSYNC_DISCARD : CL_FSYNC_LOCAL;
220 rc = cl_sync_file_range(inode, 0, end, mode, 1);
221 truncate_inode_pages_range(inode->i_mapping, 0, end);
223 cl_env_put(env, &refcheck);
227 int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
228 void *data, int flag)
230 struct lustre_handle lockh;
235 case LDLM_CB_BLOCKING:
236 ldlm_lock2handle(lock, &lockh);
237 rc = ldlm_cli_cancel(&lockh, LCF_ASYNC);
239 CDEBUG(D_INODE, "ldlm_cli_cancel: rc = %d\n", rc);
243 case LDLM_CB_CANCELING: {
244 struct inode *inode = ll_inode_from_resource_lock(lock);
245 __u64 bits = lock->l_policy_data.l_inodebits.bits;
250 /* Invalidate all dentries associated with this inode */
251 LASSERT(ldlm_is_canceling(lock));
253 if (!fid_res_name_eq(ll_inode2fid(inode),
254 &lock->l_resource->lr_name)) {
255 LDLM_ERROR(lock, "data mismatch with object "DFID"(%p)",
256 PFID(ll_inode2fid(inode)), inode);
260 if (bits & MDS_INODELOCK_XATTR) {
261 if (S_ISDIR(inode->i_mode))
262 ll_i2info(inode)->lli_def_stripe_offset = -1;
263 ll_xattr_cache_destroy(inode);
264 bits &= ~MDS_INODELOCK_XATTR;
267 /* For OPEN locks we differentiate between lock modes
268 * LCK_CR, LCK_CW, LCK_PR - bug 22891 */
269 if (bits & MDS_INODELOCK_OPEN)
270 ll_have_md_lock(inode, &bits, lock->l_req_mode);
272 if (bits & MDS_INODELOCK_OPEN) {
275 switch (lock->l_req_mode) {
286 LDLM_ERROR(lock, "bad lock mode for OPEN lock");
290 ll_md_real_close(inode, fmode);
292 bits &= ~MDS_INODELOCK_OPEN;
295 if (bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
296 MDS_INODELOCK_LAYOUT | MDS_INODELOCK_PERM |
298 ll_have_md_lock(inode, &bits, LCK_MINMODE);
300 if (bits & MDS_INODELOCK_DOM) {
301 rc = ll_dom_lock_cancel(inode, lock);
303 CDEBUG(D_INODE, "cannot flush DoM data "
305 PFID(ll_inode2fid(inode)), rc);
306 lock_res_and_lock(lock);
307 ldlm_set_kms_ignore(lock);
308 unlock_res_and_lock(lock);
309 bits &= ~MDS_INODELOCK_DOM;
312 if (bits & MDS_INODELOCK_LAYOUT) {
313 struct cl_object_conf conf = {
314 .coc_opc = OBJECT_CONF_INVALIDATE,
318 rc = ll_layout_conf(inode, &conf);
320 CDEBUG(D_INODE, "cannot invalidate layout of "
322 PFID(ll_inode2fid(inode)), rc);
325 if (bits & MDS_INODELOCK_UPDATE) {
326 struct ll_inode_info *lli = ll_i2info(inode);
327 lli->lli_update_atime = 1;
330 if ((bits & MDS_INODELOCK_UPDATE) && S_ISDIR(inode->i_mode)) {
331 struct ll_inode_info *lli = ll_i2info(inode);
333 CDEBUG(D_INODE, "invalidating inode "DFID" lli = %p, "
334 "pfid = "DFID"\n", PFID(ll_inode2fid(inode)),
335 lli, PFID(&lli->lli_pfid));
336 truncate_inode_pages(inode->i_mapping, 0);
338 if (unlikely(!fid_is_zero(&lli->lli_pfid))) {
339 struct inode *master_inode = NULL;
342 /* This is slave inode, since all of the child
343 * dentry is connected on the master inode, so
344 * we have to invalidate the negative children
346 CDEBUG(D_INODE, "Invalidate s"DFID" m"DFID"\n",
347 PFID(ll_inode2fid(inode)),
348 PFID(&lli->lli_pfid));
350 hash = cl_fid_build_ino(&lli->lli_pfid,
351 ll_need_32bit_api(ll_i2sbi(inode)));
353 /* Do not lookup the inode with ilookup5,
354 * otherwise it will cause dead lock,
356 * 1. Client1 send chmod req to the MDT0, then
357 * on MDT0, it enqueues master and all of its
358 * slaves lock, (mdt_attr_set() ->
359 * mdt_lock_slaves()), after gets master and
360 * stripe0 lock, it will send the enqueue req
361 * (for stripe1) to MDT1, then MDT1 finds the
362 * lock has been granted to client2. Then MDT1
363 * sends blocking ast to client2.
365 * 2. At the same time, client2 tries to unlink
366 * the striped dir (rm -rf striped_dir), and
367 * during lookup, it will hold the master inode
368 * of the striped directory, whose inode state
369 * is NEW, then tries to revalidate all of its
370 * slaves, (ll_prep_inode()->ll_iget()->
371 * ll_read_inode2()-> ll_update_inode().). And
372 * it will be blocked on the server side because
375 * 3. Then the client get the blocking_ast req,
376 * cancel the lock, but being blocked if using
377 * ->ilookup5()), because master inode state is
379 master_inode = ilookup5_nowait(inode->i_sb,
380 hash, ll_test_inode_by_fid,
381 (void *)&lli->lli_pfid);
383 ll_invalidate_negative_children(
388 ll_invalidate_negative_children(inode);
392 if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) &&
393 inode->i_sb->s_root != NULL &&
394 inode != inode->i_sb->s_root->d_inode)
395 ll_invalidate_aliases(inode);
407 __u32 ll_i2suppgid(struct inode *i)
409 if (in_group_p(i->i_gid))
410 return (__u32)from_kgid(&init_user_ns, i->i_gid);
412 return (__u32) __kgid_val(INVALID_GID);
415 /* Pack the required supplementary groups into the supplied groups array.
416 * If we don't need to use the groups from the target inode(s) then we
417 * instead pack one or more groups from the user's supplementary group
418 * array in case it might be useful. Not needed if doing an MDS-side upcall. */
419 void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)
422 LASSERT(suppgids != NULL);
424 suppgids[0] = ll_i2suppgid(i1);
427 suppgids[1] = ll_i2suppgid(i2);
433 * try to reuse three types of dentry:
434 * 1. unhashed alias, this one is unhashed by d_invalidate (but it may be valid
435 * by concurrent .revalidate).
436 * 2. INVALID alias (common case for no valid ldlm lock held, but this flag may
437 * be cleared by others calling d_lustre_revalidate).
438 * 3. DISCONNECTED alias.
440 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
442 struct dentry *alias, *discon_alias, *invalid_alias;
443 DECLARE_LL_D_HLIST_NODE_PTR(p);
445 if (ll_d_hlist_empty(&inode->i_dentry))
448 discon_alias = invalid_alias = NULL;
450 ll_lock_dcache(inode);
451 ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry) {
452 LASSERT(alias != dentry);
454 spin_lock(&alias->d_lock);
455 if ((alias->d_flags & DCACHE_DISCONNECTED) &&
456 S_ISDIR(inode->i_mode))
457 /* LASSERT(last_discon == NULL); LU-405, bz 20055 */
458 discon_alias = alias;
459 else if (alias->d_parent == dentry->d_parent &&
460 alias->d_name.hash == dentry->d_name.hash &&
461 alias->d_name.len == dentry->d_name.len &&
462 memcmp(alias->d_name.name, dentry->d_name.name,
463 dentry->d_name.len) == 0)
464 invalid_alias = alias;
465 spin_unlock(&alias->d_lock);
470 alias = invalid_alias ?: discon_alias ?: NULL;
472 spin_lock(&alias->d_lock);
474 spin_unlock(&alias->d_lock);
476 ll_unlock_dcache(inode);
482 * Similar to d_splice_alias(), but lustre treats invalid alias
483 * similar to DCACHE_DISCONNECTED, and tries to use it anyway.
485 struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
491 new = ll_find_alias(inode, de);
501 "Reuse dentry %p inode %p refc %d flags %#x\n",
502 new, new->d_inode, ll_d_count(new), new->d_flags);
510 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
511 de, de->d_inode, ll_d_count(de), de->d_flags);
515 static int ll_lookup_it_finish(struct ptlrpc_request *request,
516 struct lookup_intent *it,
517 struct inode *parent, struct dentry **de)
519 struct inode *inode = NULL;
522 struct dentry *alias;
525 /* NB 1 request reference will be taken away by ll_intent_lock()
527 CDEBUG(D_DENTRY, "it %p it_disposition %x\n", it,
529 if (!it_disposition(it, DISP_LOOKUP_NEG)) {
530 rc = ll_prep_inode(&inode, request, (*de)->d_sb, it);
534 ll_set_lock_data(ll_i2sbi(parent)->ll_md_exp, inode, it, &bits);
536 /* We used to query real size from OSTs here, but actually
537 this is not needed. For stat() calls size would be updated
538 from subsequent do_revalidate()->ll_inode_revalidate_it() in
540 vfs_getattr_it->ll_getattr()->ll_inode_revalidate_it() in 2.6
541 Everybody else who needs correct file size would call
542 ll_glimpse_size or some equivalent themselves anyway.
543 Also see bug 7198. */
546 /* Only hash *de if it is unhashed (new dentry).
547 * Atoimc_open may passin hashed dentries for open.
549 alias = ll_splice_alias(inode, *de);
551 GOTO(out, rc = PTR_ERR(alias));
555 if (!it_disposition(it, DISP_LOOKUP_NEG)) {
556 /* we have lookup look - unhide dentry */
557 if (bits & MDS_INODELOCK_LOOKUP)
558 d_lustre_revalidate(*de);
559 } else if (!it_disposition(it, DISP_OPEN_CREATE)) {
560 /* If file created on server, don't depend on parent UPDATE
561 * lock to unhide it. It is left hidden and next lookup can
562 * find it in ll_splice_alias.
564 /* Check that parent has UPDATE lock. */
565 struct lookup_intent parent_it = {
567 .it_lock_handle = 0 };
568 struct lu_fid fid = ll_i2info(parent)->lli_fid;
570 /* If it is striped directory, get the real stripe parent */
571 if (unlikely(ll_i2info(parent)->lli_lsm_md != NULL)) {
572 rc = md_get_fid_from_lsm(ll_i2mdexp(parent),
573 ll_i2info(parent)->lli_lsm_md,
575 (*de)->d_name.len, &fid);
580 if (md_revalidate_lock(ll_i2mdexp(parent), &parent_it, &fid,
582 d_lustre_revalidate(*de);
583 ll_intent_release(&parent_it);
590 if (rc != 0 && it->it_op & IT_OPEN)
591 ll_open_cleanup((*de)->d_sb, request);
596 static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
597 struct lookup_intent *it,
598 void **secctx, __u32 *secctxlen)
600 struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
601 struct dentry *save = dentry, *retval;
602 struct ptlrpc_request *req = NULL;
603 struct md_op_data *op_data = NULL;
608 if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen)
609 RETURN(ERR_PTR(-ENAMETOOLONG));
611 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), intent=%s\n",
612 dentry->d_name.len, dentry->d_name.name,
613 PFID(ll_inode2fid(parent)), parent, LL_IT2STR(it));
615 if (d_mountpoint(dentry))
616 CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it));
618 if (it == NULL || it->it_op == IT_GETXATTR)
621 if (it->it_op == IT_GETATTR && dentry_may_statahead(parent, dentry)) {
622 rc = ll_statahead(parent, &dentry, 0);
624 RETURN(dentry == save ? NULL : dentry);
627 if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
628 dentry->d_sb->s_flags & MS_RDONLY)
629 RETURN(ERR_PTR(-EROFS));
631 if (it->it_op & IT_CREAT)
632 opc = LUSTRE_OPC_CREATE;
634 opc = LUSTRE_OPC_ANY;
636 op_data = ll_prep_md_op_data(NULL, parent, NULL, dentry->d_name.name,
637 dentry->d_name.len, 0, opc, NULL);
639 GOTO(out, retval = ERR_CAST(op_data));
641 /* enforce umask if acl disabled or MDS doesn't support umask */
642 if (!IS_POSIXACL(parent) || !exp_connect_umask(ll_i2mdexp(parent)))
643 it->it_create_mode &= ~current_umask();
645 if (it->it_op & IT_CREAT &&
646 ll_i2sbi(parent)->ll_flags & LL_SBI_FILE_SECCTX) {
647 rc = ll_dentry_init_security(dentry, it->it_create_mode,
649 &op_data->op_file_secctx_name,
650 &op_data->op_file_secctx,
651 &op_data->op_file_secctx_size);
653 GOTO(out, retval = ERR_PTR(rc));
655 *secctx = op_data->op_file_secctx;
656 if (secctxlen != NULL)
657 *secctxlen = op_data->op_file_secctx_size;
660 rc = md_intent_lock(ll_i2mdexp(parent), op_data, it, &req,
661 &ll_md_blocking_ast, 0);
662 /* If the MDS allows the client to chgrp (CFS_SETGRP_PERM), but the
663 * client does not know which suppgid should be sent to the MDS, or
664 * some other(s) changed the target file's GID after this RPC sent
665 * to the MDS with the suppgid as the original GID, then we should
666 * try again with right suppgid. */
667 if (rc == -EACCES && it->it_op & IT_OPEN &&
668 it_disposition(it, DISP_OPEN_DENY)) {
669 struct mdt_body *body;
671 LASSERT(req != NULL);
673 body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
674 if (op_data->op_suppgids[0] == body->mbo_gid ||
675 op_data->op_suppgids[1] == body->mbo_gid ||
676 !in_group_p(make_kgid(&init_user_ns, body->mbo_gid)))
677 GOTO(out, retval = ERR_PTR(-EACCES));
679 fid_zero(&op_data->op_fid2);
680 op_data->op_suppgids[1] = body->mbo_gid;
681 ptlrpc_req_finished(req);
683 ll_intent_release(it);
684 rc = md_intent_lock(ll_i2mdexp(parent), op_data, it, &req,
685 &ll_md_blocking_ast, 0);
689 GOTO(out, retval = ERR_PTR(rc));
691 rc = ll_lookup_it_finish(req, it, parent, &dentry);
693 ll_intent_release(it);
694 GOTO(out, retval = ERR_PTR(rc));
697 if ((it->it_op & IT_OPEN) && dentry->d_inode &&
698 !S_ISREG(dentry->d_inode->i_mode) &&
699 !S_ISDIR(dentry->d_inode->i_mode)) {
700 ll_release_openhandle(dentry, it);
702 ll_lookup_finish_locks(it, dentry);
704 GOTO(out, retval = (dentry == save) ? NULL : dentry);
707 if (op_data != NULL && !IS_ERR(op_data)) {
708 if (secctx != NULL && secctxlen != NULL) {
709 /* caller needs sec ctx info, so reset it in op_data to
710 * prevent it from being freed */
711 op_data->op_file_secctx = NULL;
712 op_data->op_file_secctx_size = 0;
714 ll_finish_md_op_data(op_data);
717 ptlrpc_req_finished(req);
721 #ifdef HAVE_IOP_ATOMIC_OPEN
722 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
725 struct lookup_intent *itp, it = { .it_op = IT_GETATTR };
728 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), flags=%u\n",
729 dentry->d_name.len, dentry->d_name.name,
730 PFID(ll_inode2fid(parent)), parent, flags);
733 * Optimize away (CREATE && !OPEN). Let .create handle the race.
734 * but only if we have write permissions there, otherwise we need
735 * to proceed with lookup. LU-4185
737 if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN) &&
738 (inode_permission(parent, MAY_WRITE | MAY_EXEC) == 0))
741 if (flags & (LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE))
745 de = ll_lookup_it(parent, dentry, itp, NULL, NULL);
748 ll_intent_release(itp);
754 * For cached negative dentry and new dentry, handle lookup/create/open
757 static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
758 struct file *file, unsigned open_flags,
759 umode_t mode, int *opened)
761 struct lookup_intent *it;
763 long long lookup_flags = LOOKUP_OPEN;
769 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), file %p,"
770 "open_flags %x, mode %x opened %d\n",
771 dentry->d_name.len, dentry->d_name.name,
772 PFID(ll_inode2fid(dir)), dir, file, open_flags, mode, *opened);
774 /* Only negative dentries enter here */
775 LASSERT(dentry->d_inode == NULL);
777 if (!d_unhashed(dentry)) {
778 /* A valid negative dentry that just passed revalidation,
779 * there's little point to try and open it server-side,
780 * even though there's a minuscule chance it might succeed.
781 * Either way it's a valid race to just return -ENOENT here.
783 if (!(open_flags & O_CREAT))
786 /* Otherwise we just unhash it to be rehashed afresh via
787 * lookup if necessary
792 OBD_ALLOC(it, sizeof(*it));
797 if (open_flags & O_CREAT) {
798 it->it_op |= IT_CREAT;
799 lookup_flags |= LOOKUP_CREATE;
801 it->it_create_mode = (mode & S_IALLUGO) | S_IFREG;
802 it->it_flags = (open_flags & ~O_ACCMODE) | OPEN_FMODE(open_flags);
803 it->it_flags &= ~MDS_OPEN_FL_INTERNAL;
805 /* Dentry added to dcache tree in ll_lookup_it */
806 de = ll_lookup_it(dir, dentry, it, &secctx, &secctxlen);
812 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val);
815 if (it_disposition(it, DISP_OPEN_CREATE)) {
816 /* Dentry instantiated in ll_create_it. */
817 rc = ll_create_it(dir, dentry, it, secctx, secctxlen);
818 security_release_secctx(secctx, secctxlen);
820 /* We dget in ll_splice_alias. */
826 *opened |= FILE_CREATED;
828 if (dentry->d_inode && it_disposition(it, DISP_OPEN_OPEN)) {
830 if (S_ISFIFO(dentry->d_inode->i_mode)) {
831 /* We cannot call open here as it might
832 * deadlock. This case is unreachable in
833 * practice because of OBD_CONNECT_NODEVOH. */
834 rc = finish_no_open(file, de);
836 file->private_data = it;
837 rc = finish_open(file, dentry, NULL, opened);
838 /* We dget in ll_splice_alias. finish_open takes
839 * care of dget for fd open.
845 rc = finish_no_open(file, de);
850 ll_intent_release(it);
851 OBD_FREE(it, sizeof(*it));
856 #else /* !HAVE_IOP_ATOMIC_OPEN */
857 static struct lookup_intent *
858 ll_convert_intent(struct open_intent *oit, int lookup_flags, bool is_readonly)
860 struct lookup_intent *it;
864 return ERR_PTR(-ENOMEM);
866 if (lookup_flags & LOOKUP_OPEN) {
868 /* Avoid file creation for ro bind mount point(is_readonly) */
869 if ((lookup_flags & LOOKUP_CREATE) && !is_readonly)
870 it->it_op |= IT_CREAT;
871 it->it_create_mode = (oit->create_mode & S_IALLUGO) | S_IFREG;
872 it->it_flags = ll_namei_to_lookup_intent_flag(oit->flags &
873 ~(is_readonly ? O_CREAT : 0));
874 it->it_flags &= ~MDS_OPEN_FL_INTERNAL;
876 it->it_op = IT_GETATTR;
882 static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
883 struct nameidata *nd)
888 if (nd && !(nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))) {
889 struct lookup_intent *it;
891 if (ll_d2d(dentry) && ll_d2d(dentry)->lld_it) {
892 it = ll_d2d(dentry)->lld_it;
893 ll_d2d(dentry)->lld_it = NULL;
896 * Optimize away (CREATE && !OPEN). Let .create handle
897 * the race. But only if we have write permissions
898 * there, otherwise we need to proceed with lookup.
901 if ((nd->flags & LOOKUP_CREATE) &&
902 !(nd->flags & LOOKUP_OPEN) &&
903 (inode_permission(parent,
904 MAY_WRITE | MAY_EXEC) == 0))
907 it = ll_convert_intent(&nd->intent.open, nd->flags,
908 (nd->path.mnt->mnt_flags & MNT_READONLY) ||
909 (nd->path.mnt->mnt_sb->s_flags & MS_RDONLY));
911 RETURN((struct dentry *)it);
914 de = ll_lookup_it(parent, dentry, it, NULL, NULL);
917 if ((nd->flags & LOOKUP_OPEN) && !IS_ERR(dentry)) { /* Open */
918 if (dentry->d_inode &&
919 it_disposition(it, DISP_OPEN_OPEN)) { /* nocreate */
920 if (S_ISFIFO(dentry->d_inode->i_mode)) {
921 /* We cannot call open here as it might
922 * deadlock. This case is unreachable in
923 * practice because of
924 * OBD_CONNECT_NODEVOH. */
928 nd->intent.open.file->private_data = it;
929 filp = lookup_instantiate_filp(nd,
935 de = (struct dentry *)filp;
938 } else if (it_disposition(it, DISP_OPEN_CREATE)) {
939 /* XXX This can only reliably work on assumption
940 * that there are NO hashed negative dentries.*/
941 ll_d2d(dentry)->lld_it = it;
942 it = NULL; /* Will be freed in ll_create_nd */
943 /* We absolutely depend on ll_create_nd to be
944 * called to not leak this intent and possible
945 * data attached to it */
950 ll_intent_release(it);
951 OBD_FREE(it, sizeof(*it));
954 de = ll_lookup_it(parent, dentry, NULL, NULL, NULL);
959 #endif /* HAVE_IOP_ATOMIC_OPEN */
961 /* We depend on "mode" being set with the proper file type/umask by now */
962 static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)
964 struct inode *inode = NULL;
965 struct ptlrpc_request *request = NULL;
966 struct ll_sb_info *sbi = ll_i2sbi(dir);
970 LASSERT(it && it->it_disposition);
972 LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF));
973 request = it->it_request;
974 it_clear_disposition(it, DISP_ENQ_CREATE_REF);
975 rc = ll_prep_inode(&inode, request, dir->i_sb, it);
977 GOTO(out, inode = ERR_PTR(rc));
979 /* Pause to allow for a race with concurrent access by fid */
980 OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_NODE_PAUSE, cfs_fail_val);
982 /* We asked for a lock on the directory, but were granted a
983 * lock on the inode. Since we finally have an inode pointer,
984 * stuff it in the lock. */
985 CDEBUG(D_DLMTRACE, "setting l_ast_data to inode "DFID"(%p)\n",
986 PFID(ll_inode2fid(inode)), inode);
987 ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL);
990 ptlrpc_req_finished(request);
995 * By the time this is called, we already have created the directory cache
996 * entry for the new file, but it is so far negative - it has no inode.
998 * We defer creating the OBD object(s) until open, to keep the intent and
999 * non-intent code paths similar, and also because we do not have the MDS
1000 * inode number before calling ll_create_node() (which is needed for LOV),
1001 * so we would need to do yet another RPC to the MDS to store the LOV EA
1002 * data on the MDS. If needed, we would pass the PACKED lmm as data and
1003 * lmm_size in datalen (the MDS still has code which will handle that).
1005 * If the create succeeds, we fill in the inode information
1006 * with d_instantiate().
1008 static int ll_create_it(struct inode *dir, struct dentry *dentry,
1009 struct lookup_intent *it,
1010 void *secctx, __u32 secctxlen)
1012 struct inode *inode;
1016 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), intent=%s\n",
1017 dentry->d_name.len, dentry->d_name.name,
1018 PFID(ll_inode2fid(dir)), dir, LL_IT2STR(it));
1020 rc = it_open_error(DISP_OPEN_CREATE, it);
1024 inode = ll_create_node(dir, it);
1026 RETURN(PTR_ERR(inode));
1028 if ((ll_i2sbi(inode)->ll_flags & LL_SBI_FILE_SECCTX) &&
1031 /* must be done before d_instantiate, because it calls
1032 * security_d_instantiate, which means a getxattr if security
1033 * context is not set yet */
1034 rc = security_inode_notifysecctx(inode, secctx, secctxlen);
1035 inode_unlock(inode);
1040 d_instantiate(dentry, inode);
1042 if (!(ll_i2sbi(inode)->ll_flags & LL_SBI_FILE_SECCTX)) {
1043 rc = ll_inode_init_security(dentry, inode, dir);
1051 void ll_update_times(struct ptlrpc_request *request, struct inode *inode)
1053 struct mdt_body *body = req_capsule_server_get(&request->rq_pill,
1057 if (body->mbo_valid & OBD_MD_FLMTIME &&
1058 body->mbo_mtime > LTIME_S(inode->i_mtime)) {
1059 CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu"
1060 "\n", PFID(ll_inode2fid(inode)),
1061 LTIME_S(inode->i_mtime), body->mbo_mtime);
1062 LTIME_S(inode->i_mtime) = body->mbo_mtime;
1065 if (body->mbo_valid & OBD_MD_FLCTIME &&
1066 body->mbo_ctime > LTIME_S(inode->i_ctime))
1067 LTIME_S(inode->i_ctime) = body->mbo_ctime;
1070 static int ll_new_node(struct inode *dir, struct dentry *dchild,
1071 const char *tgt, umode_t mode, int rdev, __u32 opc)
1073 struct qstr *name = &dchild->d_name;
1074 struct ptlrpc_request *request = NULL;
1075 struct md_op_data *op_data;
1076 struct inode *inode = NULL;
1077 struct ll_sb_info *sbi = ll_i2sbi(dir);
1082 if (unlikely(tgt != NULL))
1083 tgt_len = strlen(tgt) + 1;
1086 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
1087 name->len, 0, opc, NULL);
1088 if (IS_ERR(op_data))
1089 GOTO(err_exit, err = PTR_ERR(op_data));
1091 if (sbi->ll_flags & LL_SBI_FILE_SECCTX) {
1092 err = ll_dentry_init_security(dchild, mode, &dchild->d_name,
1093 &op_data->op_file_secctx_name,
1094 &op_data->op_file_secctx,
1095 &op_data->op_file_secctx_size);
1097 GOTO(err_exit, err);
1100 err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
1101 from_kuid(&init_user_ns, current_fsuid()),
1102 from_kgid(&init_user_ns, current_fsgid()),
1103 cfs_curproc_cap_pack(), rdev, &request);
1104 if (err < 0 && err != -EREMOTE)
1105 GOTO(err_exit, err);
1107 /* If the client doesn't know where to create a subdirectory (or
1108 * in case of a race that sends the RPC to the wrong MDS), the
1109 * MDS will return -EREMOTE and the client will fetch the layout
1110 * of the directory, then create the directory on the right MDT. */
1111 if (unlikely(err == -EREMOTE)) {
1112 struct ll_inode_info *lli = ll_i2info(dir);
1113 struct lmv_user_md *lum;
1117 ptlrpc_req_finished(request);
1120 err2 = ll_dir_getstripe(dir, (void **)&lum, &lumsize, &request,
1121 OBD_MD_DEFAULT_MEA);
1123 /* Update stripe_offset and retry */
1124 lli->lli_def_stripe_offset = lum->lum_stripe_offset;
1125 } else if (err2 == -ENODATA &&
1126 lli->lli_def_stripe_offset != -1) {
1127 /* If there are no default stripe EA on the MDT, but the
1128 * client has default stripe, then it probably means
1129 * default stripe EA has just been deleted. */
1130 lli->lli_def_stripe_offset = -1;
1132 GOTO(err_exit, err);
1135 ptlrpc_req_finished(request);
1137 ll_finish_md_op_data(op_data);
1141 ll_update_times(request, dir);
1143 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_NEWNODE_PAUSE, cfs_fail_val);
1145 err = ll_prep_inode(&inode, request, dchild->d_sb, NULL);
1147 GOTO(err_exit, err);
1149 if (sbi->ll_flags & LL_SBI_FILE_SECCTX) {
1151 /* must be done before d_instantiate, because it calls
1152 * security_d_instantiate, which means a getxattr if security
1153 * context is not set yet */
1154 err = security_inode_notifysecctx(inode,
1155 op_data->op_file_secctx,
1156 op_data->op_file_secctx_size);
1157 inode_unlock(inode);
1159 GOTO(err_exit, err);
1162 d_instantiate(dchild, inode);
1164 if (!(sbi->ll_flags & LL_SBI_FILE_SECCTX)) {
1165 err = ll_inode_init_security(dchild, inode, dir);
1167 GOTO(err_exit, err);
1172 if (request != NULL)
1173 ptlrpc_req_finished(request);
1175 if (!IS_ERR_OR_NULL(op_data))
1176 ll_finish_md_op_data(op_data);
1181 static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode,
1184 struct qstr *name = &dchild->d_name;
1188 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p) mode %o dev %x\n",
1189 name->len, name->name, PFID(ll_inode2fid(dir)), dir,
1192 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
1193 mode &= ~current_umask();
1195 switch (mode & S_IFMT) {
1197 mode |= S_IFREG; /* for mode = 0 case, fallthrough */
1203 err = ll_new_node(dir, dchild, NULL, mode, old_encode_dev(rdev),
1214 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKNOD, 1);
1219 #ifdef HAVE_IOP_ATOMIC_OPEN
1221 * Plain create. Intent create is handled in atomic_open.
1223 static int ll_create_nd(struct inode *dir, struct dentry *dentry,
1224 umode_t mode, bool want_excl)
1228 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val);
1230 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), "
1231 "flags=%u, excl=%d\n", dentry->d_name.len,
1232 dentry->d_name.name, PFID(ll_inode2fid(dir)),
1233 dir, mode, want_excl);
1235 /* Using mknod(2) to create a regular file is designed to not recognize
1236 * volatile file name, so we use ll_mknod() here. */
1237 rc = ll_mknod(dir, dentry, mode, 0);
1239 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1);
1241 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, unhashed %d\n",
1242 dentry->d_name.len, dentry->d_name.name, d_unhashed(dentry));
1246 #else /* !HAVE_IOP_ATOMIC_OPEN */
1247 static int ll_create_nd(struct inode *dir, struct dentry *dentry,
1248 ll_umode_t mode, struct nameidata *nd)
1250 struct ll_dentry_data *lld = ll_d2d(dentry);
1251 struct lookup_intent *it = NULL;
1254 CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val);
1260 /* LU-8559: use LUSTRE_OPC_CREATE for non atomic open case
1261 * so that volatile file name is recoginized.
1262 * Mknod(2), however, is designed to not recognize volatile
1263 * file name to avoid inode leak under orphan directory until
1265 return ll_new_node(dir, dentry, NULL, mode, 0,
1271 /* Was there an error? Propagate it! */
1272 if (it->it_status) {
1277 rc = ll_create_it(dir, dentry, it, NULL, 0);
1278 if (nd && (nd->flags & LOOKUP_OPEN) && dentry->d_inode) { /* Open */
1281 nd->intent.open.file->private_data = it;
1282 filp = lookup_instantiate_filp(nd, dentry, NULL);
1288 ll_intent_release(it);
1289 OBD_FREE(it, sizeof(*it));
1292 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1);
1296 #endif /* HAVE_IOP_ATOMIC_OPEN */
1298 static int ll_symlink(struct inode *dir, struct dentry *dchild,
1299 const char *oldpath)
1301 struct qstr *name = &dchild->d_name;
1305 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p), target=%.*s\n",
1306 name->len, name->name, PFID(ll_inode2fid(dir)),
1307 dir, 3000, oldpath);
1309 err = ll_new_node(dir, dchild, oldpath, S_IFLNK | S_IRWXUGO, 0,
1310 LUSTRE_OPC_SYMLINK);
1313 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1);
1318 static int ll_link(struct dentry *old_dentry, struct inode *dir,
1319 struct dentry *new_dentry)
1321 struct inode *src = old_dentry->d_inode;
1322 struct qstr *name = &new_dentry->d_name;
1323 struct ll_sb_info *sbi = ll_i2sbi(dir);
1324 struct ptlrpc_request *request = NULL;
1325 struct md_op_data *op_data;
1329 CDEBUG(D_VFSTRACE, "VFS Op: inode="DFID"(%p), dir="DFID"(%p), "
1330 "target=%.*s\n", PFID(ll_inode2fid(src)), src,
1331 PFID(ll_inode2fid(dir)), dir, name->len, name->name);
1333 op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len,
1334 0, LUSTRE_OPC_ANY, NULL);
1335 if (IS_ERR(op_data))
1336 RETURN(PTR_ERR(op_data));
1338 err = md_link(sbi->ll_md_exp, op_data, &request);
1339 ll_finish_md_op_data(op_data);
1343 ll_update_times(request, dir);
1344 ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
1347 ptlrpc_req_finished(request);
1351 static int ll_mkdir(struct inode *dir, struct dentry *dchild, ll_umode_t mode)
1353 struct qstr *name = &dchild->d_name;
1357 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p)\n",
1358 name->len, name->name, PFID(ll_inode2fid(dir)), dir);
1360 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
1361 mode &= ~current_umask();
1363 mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR;
1365 err = ll_new_node(dir, dchild, NULL, mode, 0, LUSTRE_OPC_MKDIR);
1367 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1);
1372 static int ll_rmdir(struct inode *dir, struct dentry *dchild)
1374 struct qstr *name = &dchild->d_name;
1375 struct ptlrpc_request *request = NULL;
1376 struct md_op_data *op_data;
1380 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p)\n",
1381 name->len, name->name, PFID(ll_inode2fid(dir)), dir);
1383 if (unlikely(d_mountpoint(dchild)))
1386 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len,
1387 S_IFDIR, LUSTRE_OPC_ANY, NULL);
1388 if (IS_ERR(op_data))
1389 RETURN(PTR_ERR(op_data));
1391 if (dchild->d_inode != NULL)
1392 op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
1394 op_data->op_fid2 = op_data->op_fid3;
1395 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1396 ll_finish_md_op_data(op_data);
1398 ll_update_times(request, dir);
1399 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1);
1402 ptlrpc_req_finished(request);
1409 int ll_rmdir_entry(struct inode *dir, char *name, int namelen)
1411 struct ptlrpc_request *request = NULL;
1412 struct md_op_data *op_data;
1416 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p)\n",
1417 namelen, name, PFID(ll_inode2fid(dir)), dir);
1419 op_data = ll_prep_md_op_data(NULL, dir, NULL, name, strlen(name),
1420 S_IFDIR, LUSTRE_OPC_ANY, NULL);
1421 if (IS_ERR(op_data))
1422 RETURN(PTR_ERR(op_data));
1423 op_data->op_cli_flags |= CLI_RM_ENTRY;
1424 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1425 ll_finish_md_op_data(op_data);
1427 ll_update_times(request, dir);
1428 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1);
1431 ptlrpc_req_finished(request);
1435 static int ll_unlink(struct inode *dir, struct dentry *dchild)
1437 struct qstr *name = &dchild->d_name;
1438 struct ptlrpc_request *request = NULL;
1439 struct md_op_data *op_data;
1442 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p)\n",
1443 name->len, name->name, PFID(ll_inode2fid(dir)), dir);
1446 * XXX: unlink bind mountpoint maybe call to here,
1447 * just check it as vfs_unlink does.
1449 if (unlikely(d_mountpoint(dchild)))
1452 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len, 0,
1453 LUSTRE_OPC_ANY, NULL);
1454 if (IS_ERR(op_data))
1455 RETURN(PTR_ERR(op_data));
1457 if (dchild->d_inode != NULL)
1458 op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
1460 op_data->op_fid2 = op_data->op_fid3;
1461 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1462 ll_finish_md_op_data(op_data);
1466 ll_update_times(request, dir);
1467 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1);
1470 ptlrpc_req_finished(request);
1474 static int ll_rename(struct inode *src, struct dentry *src_dchild,
1475 struct inode *tgt, struct dentry *tgt_dchild
1476 #ifdef HAVE_IOPS_RENAME_WITH_FLAGS
1477 , unsigned int flags
1481 struct qstr *src_name = &src_dchild->d_name;
1482 struct qstr *tgt_name = &tgt_dchild->d_name;
1483 struct ptlrpc_request *request = NULL;
1484 struct ll_sb_info *sbi = ll_i2sbi(src);
1485 struct md_op_data *op_data;
1489 #ifdef HAVE_IOPS_RENAME_WITH_FLAGS
1494 CDEBUG(D_VFSTRACE, "VFS Op:oldname=%.*s, src_dir="DFID
1495 "(%p), newname=%.*s, tgt_dir="DFID"(%p)\n",
1496 src_name->len, src_name->name,
1497 PFID(ll_inode2fid(src)), src, tgt_name->len,
1498 tgt_name->name, PFID(ll_inode2fid(tgt)), tgt);
1500 if (unlikely(d_mountpoint(src_dchild) || d_mountpoint(tgt_dchild)))
1503 op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0,
1504 LUSTRE_OPC_ANY, NULL);
1505 if (IS_ERR(op_data))
1506 RETURN(PTR_ERR(op_data));
1508 if (src_dchild->d_inode != NULL)
1509 op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
1511 if (tgt_dchild->d_inode != NULL)
1512 op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
1514 err = md_rename(sbi->ll_md_exp, op_data,
1515 src_name->name, src_name->len,
1516 tgt_name->name, tgt_name->len, &request);
1517 ll_finish_md_op_data(op_data);
1519 ll_update_times(request, src);
1520 ll_update_times(request, tgt);
1521 ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1);
1524 ptlrpc_req_finished(request);
1527 d_move(src_dchild, tgt_dchild);
1532 const struct inode_operations ll_dir_inode_operations = {
1534 #ifdef HAVE_IOP_ATOMIC_OPEN
1535 .atomic_open = ll_atomic_open,
1537 .lookup = ll_lookup_nd,
1538 .create = ll_create_nd,
1539 /* We need all these non-raw things for NFSD, to not patch it. */
1540 .unlink = ll_unlink,
1543 .symlink = ll_symlink,
1545 .rename = ll_rename,
1546 .setattr = ll_setattr,
1547 .getattr = ll_getattr,
1548 .permission = ll_inode_permission,
1549 #ifdef HAVE_IOP_XATTR
1550 .setxattr = ll_setxattr,
1551 .getxattr = ll_getxattr,
1552 .removexattr = ll_removexattr,
1554 .listxattr = ll_listxattr,
1555 #ifdef HAVE_IOP_GET_ACL
1556 .get_acl = ll_get_acl,
1558 #ifdef HAVE_IOP_SET_ACL
1559 .set_acl = ll_set_acl,
1563 const struct inode_operations ll_special_inode_operations = {
1564 .setattr = ll_setattr,
1565 .getattr = ll_getattr,
1566 .permission = ll_inode_permission,
1567 #ifdef HAVE_IOP_XATTR
1568 .setxattr = ll_setxattr,
1569 .getxattr = ll_getxattr,
1570 .removexattr = ll_removexattr,
1572 .listxattr = ll_listxattr,
1573 #ifdef HAVE_IOP_GET_ACL
1574 .get_acl = ll_get_acl,
1576 #ifdef HAVE_IOP_SET_ACL
1577 .set_acl = ll_set_acl,