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) 2007, 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/xattr.h>
36 #ifdef HAVE_LINUX_SELINUX_IS_ENABLED
37 #include <linux/selinux.h>
40 #define DEBUG_SUBSYSTEM S_LLITE
42 #include <obd_support.h>
43 #include <lustre_dlm.h>
44 #include <lustre_swab.h>
46 #include "llite_internal.h"
48 #ifndef HAVE_XATTR_HANDLER_NAME
49 static inline const char *xattr_prefix(const struct xattr_handler *handler)
51 return handler->prefix;
55 const struct xattr_handler *get_xattr_type(const char *name)
59 for (i = 0; ll_xattr_handlers[i]; i++) {
60 const char *prefix = xattr_prefix(ll_xattr_handlers[i]);
61 size_t prefix_len = strlen(prefix);
63 if (!strncmp(prefix, name, prefix_len))
64 return ll_xattr_handlers[i];
70 static int xattr_type_filter(struct ll_sb_info *sbi,
71 const struct xattr_handler *handler)
73 /* No handler means XATTR_OTHER_T */
77 if ((handler->flags == XATTR_ACL_ACCESS_T ||
78 handler->flags == XATTR_ACL_DEFAULT_T) &&
79 !test_bit(LL_SBI_ACL, sbi->ll_flags))
82 if (handler->flags == XATTR_USER_T &&
83 !test_bit(LL_SBI_USER_XATTR, sbi->ll_flags))
86 if (handler->flags == XATTR_TRUSTED_T &&
87 !capable(CAP_SYS_ADMIN))
93 #ifndef HAVE_USER_NAMESPACE_ARG
94 #define ll_xattr_set_common(hd, ns, de, inode, name, value, size, flags) \
95 ll_xattr_set_common(hd, de, inode, name, value, size, flags)
98 static int ll_xattr_set_common(const struct xattr_handler *handler,
99 struct user_namespace *mnt_userns,
100 struct dentry *dentry, struct inode *inode,
101 const char *name, const void *value, size_t size,
104 struct ll_sb_info *sbi = ll_i2sbi(inode);
105 struct ptlrpc_request *req = NULL;
106 const char *pv = value;
108 ktime_t kstart = ktime_get();
113 /* When setxattr() is called with a size of 0 the value is
114 * unconditionally replaced by "". When removexattr() is
115 * called we get a NULL value and XATTR_REPLACE for flags. */
116 if (!value && flags == XATTR_REPLACE)
117 valid = OBD_MD_FLXATTRRM;
119 valid = OBD_MD_FLXATTR;
121 /* FIXME: enable IMA when the conditions are ready */
122 if (handler->flags == XATTR_SECURITY_T &&
123 (!strcmp(name, "ima") || !strcmp(name, "evm")))
126 rc = xattr_type_filter(sbi, handler);
130 if ((handler->flags == XATTR_ACL_ACCESS_T ||
131 handler->flags == XATTR_ACL_DEFAULT_T) &&
132 !inode_owner_or_capable(mnt_userns, inode))
135 /* b10667: ignore lustre special xattr for now */
136 if (!strcmp(name, "hsm") ||
137 ((handler->flags == XATTR_TRUSTED_T && !strcmp(name, "lov")) ||
138 (handler->flags == XATTR_LUSTRE_T && !strcmp(name, "lov"))))
141 rc = ll_security_secctx_name_filter(sbi, handler->flags, name);
146 * In user.* namespace, only regular files and directories can have
147 * extended attributes.
149 if (handler->flags == XATTR_USER_T) {
150 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
154 /* This check is required for compatibility with 2.14, in which
155 * encryption context is stored in security.c xattr.
156 * Setting the encryption context should only be possible by llcrypt
157 * when defining an encryption policy on a directory.
158 * When new files/dirs are created in an encrypted dir, the enc
159 * context is set directly in the create request.
161 if (handler->flags == XATTR_SECURITY_T && strcmp(name, "c") == 0)
164 fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
168 rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, fullname,
169 pv, size, flags, ll_i2suppgid(inode), &req);
172 if (rc == -EOPNOTSUPP && handler->flags == XATTR_USER_T) {
173 LCONSOLE_INFO("Disabling user_xattr feature because it is not supported on the server\n");
174 clear_bit(LL_SBI_USER_XATTR, sbi->ll_flags);
179 ptlrpc_req_finished(req);
181 ll_stats_ops_tally(ll_i2sbi(inode), valid == OBD_MD_FLXATTRRM ?
182 LPROC_LL_REMOVEXATTR : LPROC_LL_SETXATTR,
183 ktime_us_delta(ktime_get(), kstart));
188 static int get_hsm_state(struct inode *inode, u32 *hus_states)
190 struct md_op_data *op_data;
191 struct hsm_user_state *hus;
198 op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
199 LUSTRE_OPC_ANY, hus);
200 if (!IS_ERR(op_data)) {
201 rc = obd_iocontrol(LL_IOC_HSM_STATE_GET, ll_i2mdexp(inode),
202 sizeof(*op_data), op_data, NULL);
204 *hus_states = hus->hus_states;
206 CDEBUG(D_VFSTRACE, "obd_iocontrol failed. rc = %d\n",
209 ll_finish_md_op_data(op_data);
211 rc = PTR_ERR(op_data);
212 CDEBUG(D_VFSTRACE, "Could not prepare the opdata. rc = %d\n",
219 static int ll_adjust_lum(struct inode *inode, struct lov_user_md *lump, size_t size)
221 struct lov_comp_md_v1 *comp_v1 = (struct lov_comp_md_v1 *)lump;
222 struct lov_user_md *v1 = lump;
223 bool need_clear_release = false;
224 bool release_checked = false;
225 bool is_composite = false;
233 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
234 if (size < sizeof(*comp_v1))
237 entry_count = comp_v1->lcm_entry_count;
238 if (size < offsetof(typeof(*comp_v1), lcm_entries[entry_count]))
243 for (i = 0; i < entry_count; i++) {
244 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
247 if (comp_v1->lcm_entries[i].lcme_offset + sizeof(*v1) >
251 ptr += comp_v1->lcm_entries[i].lcme_offset;
252 v1 = (struct lov_user_md *)ptr;
256 * Attributes that are saved via getxattr will always
257 * have the stripe_offset as 0. Instead, the MDS
258 * should be allowed to pick the starting OST index.
261 if (!is_composite && v1->lmm_stripe_offset == 0)
262 v1->lmm_stripe_offset = -1;
264 /* Avoid anyone directly setting the RELEASED flag. */
265 if (v1->lmm_pattern & LOV_PATTERN_F_RELEASED) {
266 if (!release_checked) {
269 rc = get_hsm_state(inode, &state);
273 if (!(state & HS_ARCHIVED))
274 need_clear_release = true;
275 release_checked = true;
277 if (need_clear_release)
278 v1->lmm_pattern ^= LOV_PATTERN_F_RELEASED;
285 static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump,
288 struct inode *inode = dentry->d_inode;
292 * It is possible to set an xattr to a "" value of zero size.
293 * For this case we are going to treat it as a removal.
298 if (size && size < sizeof(*lump)) {
299 /* ll_adjust_lum() or ll_lov_user_md_size() might access
300 * before size - just give up now.
304 rc = ll_adjust_lum(inode, lump, size);
308 if (lump && S_ISREG(inode->i_mode)) {
309 u64 it_flags = FMODE_WRITE;
312 lum_size = ll_lov_user_md_size(lump);
313 if (lum_size < 0 || size < lum_size)
316 rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags, lump,
319 * b=10667: ignore -EEXIST.
320 * Silently eat error on setting trusted.lov/lustre.lov
321 * attribute for platforms that added the default option
322 * to copy all attributes in 'cp' command. Both rsync and
323 * tar --xattrs also will try to set LOVEA for existing
328 } else if (S_ISDIR(inode->i_mode)) {
329 if (size != 0 && size < sizeof(struct lov_user_md))
332 rc = ll_dir_setstripe(inode, lump, 0);
338 #ifndef HAVE_USER_NAMESPACE_ARG
339 #define ll_xattr_set(hd, ns, de, inode, name, value, size, flags) \
340 ll_xattr_set(hd, de, inode, name, value, size, flags)
343 static int ll_xattr_set(const struct xattr_handler *handler,
344 struct user_namespace *mnt_userns,
345 struct dentry *dentry, struct inode *inode,
346 const char *name, const void *value, size_t size,
349 ktime_t kstart = ktime_get();
350 int op_type = flags == XATTR_REPLACE ? LPROC_LL_REMOVEXATTR :
357 CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n",
358 PFID(ll_inode2fid(inode)), inode, name);
360 /* lustre/trusted.lov.xxx would be passed through xattr API */
361 if (!strcmp(name, "lov")) {
362 rc = ll_setstripe_ea(dentry, (struct lov_user_md *)value,
364 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
365 ktime_us_delta(ktime_get(), kstart));
367 } else if (!strcmp(name, "lma") || !strcmp(name, "link")) {
368 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
369 ktime_us_delta(ktime_get(), kstart));
373 if (strncmp(name, "lov.", 4) == 0 &&
374 (__swab32(((struct lov_user_md *)value)->lmm_magic) &
375 le32_to_cpu(LOV_MAGIC_MASK)) == le32_to_cpu(LOV_MAGIC_MAGIC))
376 lustre_swab_lov_user_md((struct lov_user_md *)value, 0);
378 return ll_xattr_set_common(handler, mnt_userns, dentry, inode, name,
382 int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
383 size_t size, u64 valid)
385 struct ll_inode_info *lli = ll_i2info(inode);
386 struct ll_sb_info *sbi = ll_i2sbi(inode);
387 struct ptlrpc_request *req = NULL;
392 /* This check is required for compatibility with 2.14, in which
393 * encryption context is stored in security.c xattr. Accessing the
394 * encryption context should only be possible by llcrypt.
396 if (type == XATTR_SECURITY_T && strcmp(name, "security.c") == 0)
397 GOTO(out_xattr, rc = -EPERM);
399 if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
400 (type != XATTR_SECURITY_T || !ll_xattr_is_seclabel(name)) &&
401 (type != XATTR_TRUSTED_T || strcmp(name, XATTR_NAME_SOM))) {
402 rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
404 goto getxattr_nocache;
408 /* Add "system.posix_acl_access" to the list */
409 if (lli->lli_posix_acl && valid & OBD_MD_FLXATTRLS) {
411 rc += sizeof(XATTR_NAME_ACL_ACCESS);
412 } else if (size - rc >= sizeof(XATTR_NAME_ACL_ACCESS)) {
413 memcpy(buffer + rc, XATTR_NAME_ACL_ACCESS,
414 sizeof(XATTR_NAME_ACL_ACCESS));
415 rc += sizeof(XATTR_NAME_ACL_ACCESS);
417 GOTO(out_xattr, rc = -ERANGE);
422 rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid,
427 /* only detect the xattr size */
432 GOTO(out, rc = -ERANGE);
434 /* do not need swab xattr data */
435 xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
438 GOTO(out, rc = -EPROTO);
440 memcpy(buffer, xdata, rc);
446 if (rc == -EOPNOTSUPP && type == XATTR_USER_T) {
447 LCONSOLE_INFO("%s: disabling user_xattr feature because "
448 "it is not supported on the server: rc = %d\n",
450 clear_bit(LL_SBI_USER_XATTR, sbi->ll_flags);
453 ptlrpc_req_finished(req);
457 static int ll_xattr_get_common(const struct xattr_handler *handler,
458 struct dentry *dentry,
460 const char *name, void *buffer, size_t size)
462 struct ll_sb_info *sbi = ll_i2sbi(inode);
463 ktime_t kstart = ktime_get();
469 rc = xattr_type_filter(sbi, handler);
473 rc = ll_security_secctx_name_filter(sbi, handler->flags, name);
477 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
478 /* posix acl is under protection of LOOKUP lock. when calling to this,
479 * we just have path resolution to the target inode, so we have great
480 * chance that cached ACL is uptodate.
482 if (handler->flags == XATTR_ACL_ACCESS_T) {
483 struct ll_inode_info *lli = ll_i2info(inode);
484 struct posix_acl *acl;
486 read_lock(&lli->lli_lock);
487 acl = posix_acl_dup(lli->lli_posix_acl);
488 read_unlock(&lli->lli_lock);
493 rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
494 posix_acl_release(acl);
497 if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
501 fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
505 rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size,
508 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR,
509 ktime_us_delta(ktime_get(), kstart));
514 static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size)
518 if (S_ISREG(inode->i_mode)) {
519 struct cl_object *obj = ll_i2info(inode)->lli_clob;
520 struct cl_layout cl = {
521 .cl_buf.lb_buf = buf,
522 .cl_buf.lb_len = buf_size,
530 env = cl_env_get(&refcheck);
532 RETURN(PTR_ERR(env));
534 rc = cl_object_layout_get(env, obj, &cl);
539 GOTO(out_env, rc = -ENODATA);
546 LASSERT(buf && rc <= buf_size);
549 * Do not return layout gen for getxattr() since
550 * otherwise it would confuse tar --xattr by
551 * recognizing layout gen as stripe offset when the
552 * file is restored. See LU-2809.
554 if ((((struct lov_mds_md *)buf)->lmm_magic &
555 __swab32(LOV_MAGIC_MAGIC)) == __swab32(LOV_MAGIC_MAGIC))
556 lustre_swab_lov_user_md((struct lov_user_md *)buf,
559 switch (((struct lov_mds_md *)buf)->lmm_magic) {
562 case LOV_MAGIC_SPECIFIC:
563 ((struct lov_mds_md *)buf)->lmm_layout_gen = 0;
565 case LOV_MAGIC_COMP_V1:
566 case LOV_MAGIC_FOREIGN:
569 CERROR("Invalid LOV magic %08x\n",
570 ((struct lov_mds_md *)buf)->lmm_magic);
571 GOTO(out_env, rc = -EINVAL);
575 cl_env_put(env, &refcheck);
578 } else if (S_ISDIR(inode->i_mode)) {
579 struct ptlrpc_request *req = NULL;
580 struct ptlrpc_request *root_req = NULL;
581 struct lov_mds_md *lmm = NULL;
584 rc = ll_dir_getstripe_default(inode, (void **)&lmm, &lmm_size,
590 GOTO(out_req, rc = lmm_size);
592 if (buf_size < lmm_size)
593 GOTO(out_req, rc = -ERANGE);
595 memcpy(buf, lmm, lmm_size);
596 GOTO(out_req, rc = lmm_size);
599 ptlrpc_req_finished(req);
601 ptlrpc_req_finished(root_req);
609 static int ll_xattr_get(const struct xattr_handler *handler,
610 struct dentry *dentry, struct inode *inode,
611 const char *name, void *buffer, size_t size)
616 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
617 PFID(ll_inode2fid(inode)), inode, name);
619 if (!strcmp(name, "lov")) {
620 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1);
622 return ll_getxattr_lov(inode, buffer, size);
625 return ll_xattr_get_common(handler, dentry, inode, name, buffer, size);
628 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
630 struct inode *inode = dentry->d_inode;
631 struct ll_sb_info *sbi = ll_i2sbi(inode);
632 ktime_t kstart = ktime_get();
639 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
640 PFID(ll_inode2fid(inode)), inode);
642 rc = ll_xattr_list(inode, NULL, XATTR_OTHER_T, buffer, size,
648 * If we're being called to get the size of the xattr list
649 * (size == 0) then just assume that a lustre.lov xattr
659 const struct xattr_handler *xh = get_xattr_type(xattr_name);
660 bool hide_xattr = false;
662 /* Hide virtual project id xattr from the list when
663 * parent has the inherit flag and the same project id,
664 * so project id won't be messed up by copying the xattrs
665 * when mv to a tree with different project id.
667 if (xh && xh->flags == XATTR_TRUSTED_T &&
668 strcmp(xattr_name, XATTR_NAME_PROJID) == 0) {
669 struct inode *dir = d_inode(dentry->d_parent);
671 if ((ll_i2info(inode)->lli_projid ==
672 ll_i2info(dir)->lli_projid) &&
673 test_bit(LLIF_PROJECT_INHERIT,
674 &ll_i2info(dir)->lli_flags))
676 } else if (xh && xh->flags == XATTR_SECURITY_T &&
677 strcmp(xattr_name, "security.c") == 0) {
678 /* Listing xattrs should not expose encryption
679 * context. There is no handler defined for
680 * XATTR_ENCRYPTION_PREFIX, so this test is just
681 * needed for compatibility with 2.14, in which
682 * encryption context is stored in security.c xattr.
687 len = strnlen(xattr_name, rem - 1) + 1;
689 if (!xattr_type_filter(sbi, hide_xattr ? NULL : xh)) {
690 /* Skip OK xattr type, leave it in buffer. */
696 * Move up remaining xattrs in buffer
697 * removing the xattr that is not OK.
699 memmove(xattr_name, xattr_name + len, rem);
703 rc2 = ll_getxattr_lov(inode, NULL, 0);
710 if (size < rc + sizeof(XATTR_LUSTRE_LOV))
713 memcpy(buffer + rc, XATTR_LUSTRE_LOV, sizeof(XATTR_LUSTRE_LOV));
716 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR,
717 ktime_us_delta(ktime_get(), kstart));
719 RETURN(rc + sizeof(XATTR_LUSTRE_LOV));
722 #ifdef HAVE_XATTR_HANDLER_SIMPLIFIED
723 static int ll_xattr_get_common_4_3(const struct xattr_handler *handler,
724 struct dentry *dentry, const char *name,
725 void *buffer, size_t size)
727 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
731 static int ll_xattr_get_4_3(const struct xattr_handler *handler,
732 struct dentry *dentry, const char *name,
733 void *buffer, size_t size)
735 return ll_xattr_get(handler, dentry, dentry->d_inode, name, buffer,
739 static int ll_xattr_set_common_4_3(const struct xattr_handler *handler,
740 struct dentry *dentry, const char *name,
741 const void *value, size_t size, int flags)
743 return ll_xattr_set_common(handler, dentry, dentry->d_inode, name,
747 static int ll_xattr_set_4_3(const struct xattr_handler *handler,
748 struct dentry *dentry, const char *name,
749 const void *value, size_t size, int flags)
751 return ll_xattr_set(handler, dentry, dentry->d_inode, name, value,
755 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
756 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
757 const struct xattr_handler *get_xattr_handler(int handler_flag)
761 while (ll_xattr_handlers[i]) {
762 if (ll_xattr_handlers[i]->flags == handler_flag)
763 return ll_xattr_handlers[i];
769 static int ll_xattr_get_common_3_11(struct dentry *dentry, const char *name,
770 void *buffer, size_t size, int handler_flags)
772 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
777 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
781 static int ll_xattr_get_3_11(struct dentry *dentry, const char *name,
782 void *buffer, size_t size, int handler_flags)
784 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
789 return ll_xattr_get(handler, dentry, dentry->d_inode, name, buffer,
793 static int ll_xattr_set_common_3_11(struct dentry *dentry, const char *name,
794 const void *value, size_t size, int flags,
797 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
802 return ll_xattr_set_common(handler, NULL, dentry, dentry->d_inode, name,
806 static int ll_xattr_set_3_11(struct dentry *dentry, const char *name,
807 const void *value, size_t size, int flags,
810 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
815 return ll_xattr_set(handler, NULL, dentry, dentry->d_inode, name, value,
820 static const struct xattr_handler ll_user_xattr_handler = {
821 .prefix = XATTR_USER_PREFIX,
822 .flags = XATTR_USER_T,
823 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
824 .get = ll_xattr_get_common_4_3,
825 .set = ll_xattr_set_common_4_3,
826 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
827 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
828 .get = ll_xattr_get_common_3_11,
829 .set = ll_xattr_set_common_3_11,
831 .get = ll_xattr_get_common,
832 .set = ll_xattr_set_common,
836 static const struct xattr_handler ll_trusted_xattr_handler = {
837 .prefix = XATTR_TRUSTED_PREFIX,
838 .flags = XATTR_TRUSTED_T,
839 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
840 .get = ll_xattr_get_4_3,
841 .set = ll_xattr_set_4_3,
842 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
843 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
844 .get = ll_xattr_get_3_11,
845 .set = ll_xattr_set_3_11,
852 static const struct xattr_handler ll_security_xattr_handler = {
853 .prefix = XATTR_SECURITY_PREFIX,
854 .flags = XATTR_SECURITY_T,
855 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
856 .get = ll_xattr_get_common_4_3,
857 .set = ll_xattr_set_common_4_3,
858 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
859 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
860 .get = ll_xattr_get_common_3_11,
861 .set = ll_xattr_set_common_3_11,
863 .get = ll_xattr_get_common,
864 .set = ll_xattr_set_common,
868 static const struct xattr_handler ll_acl_access_xattr_handler = {
869 #ifdef HAVE_XATTR_HANDLER_NAME
870 .name = XATTR_NAME_POSIX_ACL_ACCESS,
872 .prefix = XATTR_NAME_POSIX_ACL_ACCESS,
874 .flags = XATTR_ACL_ACCESS_T,
875 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
876 .get = ll_xattr_get_common_4_3,
877 .set = ll_xattr_set_common_4_3,
878 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
879 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
880 .get = ll_xattr_get_common_3_11,
881 .set = ll_xattr_set_common_3_11,
883 .get = ll_xattr_get_common,
884 .set = ll_xattr_set_common,
888 static const struct xattr_handler ll_acl_default_xattr_handler = {
889 #ifdef HAVE_XATTR_HANDLER_NAME
890 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
892 .prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
894 .flags = XATTR_ACL_DEFAULT_T,
895 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
896 .get = ll_xattr_get_common_4_3,
897 .set = ll_xattr_set_common_4_3,
898 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
899 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
900 .get = ll_xattr_get_common_3_11,
901 .set = ll_xattr_set_common_3_11,
903 .get = ll_xattr_get_common,
904 .set = ll_xattr_set_common,
908 static const struct xattr_handler ll_lustre_xattr_handler = {
909 .prefix = XATTR_LUSTRE_PREFIX,
910 .flags = XATTR_LUSTRE_T,
911 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
912 .get = ll_xattr_get_4_3,
913 .set = ll_xattr_set_4_3,
914 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
915 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
916 .get = ll_xattr_get_3_11,
917 .set = ll_xattr_set_3_11,
924 const struct xattr_handler *ll_xattr_handlers[] = {
925 &ll_user_xattr_handler,
926 &ll_trusted_xattr_handler,
927 &ll_security_xattr_handler,
928 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
929 &ll_acl_access_xattr_handler,
930 &ll_acl_default_xattr_handler,
932 &ll_lustre_xattr_handler,