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);
178 ll_i2info(inode)->lli_synced_to_mds = false;
180 ptlrpc_req_finished(req);
182 ll_stats_ops_tally(ll_i2sbi(inode), valid == OBD_MD_FLXATTRRM ?
183 LPROC_LL_REMOVEXATTR : LPROC_LL_SETXATTR,
184 ktime_us_delta(ktime_get(), kstart));
189 static int get_hsm_state(struct inode *inode, u32 *hus_states)
191 struct md_op_data *op_data;
192 struct hsm_user_state *hus;
199 op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
200 LUSTRE_OPC_ANY, hus);
201 if (!IS_ERR(op_data)) {
202 rc = obd_iocontrol(LL_IOC_HSM_STATE_GET, ll_i2mdexp(inode),
203 sizeof(*op_data), op_data, NULL);
205 *hus_states = hus->hus_states;
207 CDEBUG(D_VFSTRACE, "obd_iocontrol failed. rc = %d\n",
210 ll_finish_md_op_data(op_data);
212 rc = PTR_ERR(op_data);
213 CDEBUG(D_VFSTRACE, "Could not prepare the opdata. rc = %d\n",
220 static int ll_adjust_lum(struct inode *inode, struct lov_user_md *lump, size_t size)
222 struct lov_comp_md_v1 *comp_v1 = (struct lov_comp_md_v1 *)lump;
223 struct lov_user_md *v1 = lump;
224 bool need_clear_release = false;
225 bool release_checked = false;
226 bool is_composite = false;
234 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
235 if (size < sizeof(*comp_v1))
238 entry_count = comp_v1->lcm_entry_count;
239 if (size < offsetof(typeof(*comp_v1), lcm_entries[entry_count]))
244 for (i = 0; i < entry_count; i++) {
245 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
248 if (comp_v1->lcm_entries[i].lcme_offset + sizeof(*v1) >
252 ptr += comp_v1->lcm_entries[i].lcme_offset;
253 v1 = (struct lov_user_md *)ptr;
257 * Attributes that are saved via getxattr will always
258 * have the stripe_offset as 0. Instead, the MDS
259 * should be allowed to pick the starting OST index.
262 if (!is_composite && v1->lmm_stripe_offset == 0)
263 v1->lmm_stripe_offset = -1;
265 /* Avoid anyone directly setting the RELEASED flag. */
266 if (v1->lmm_pattern & LOV_PATTERN_F_RELEASED) {
267 if (!release_checked) {
270 rc = get_hsm_state(inode, &state);
274 if (!(state & HS_ARCHIVED))
275 need_clear_release = true;
276 release_checked = true;
278 if (need_clear_release)
279 v1->lmm_pattern ^= LOV_PATTERN_F_RELEASED;
286 static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump,
289 struct inode *inode = dentry->d_inode;
293 * It is possible to set an xattr to a "" value of zero size.
294 * For this case we are going to treat it as a removal.
299 if (size && size < sizeof(*lump)) {
300 /* ll_adjust_lum() or ll_lov_user_md_size() might access
301 * before size - just give up now.
305 rc = ll_adjust_lum(inode, lump, size);
309 if (lump && S_ISREG(inode->i_mode)) {
310 u64 it_flags = FMODE_WRITE;
313 lum_size = ll_lov_user_md_size(lump);
314 if (lum_size < 0 || size < lum_size)
317 rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags, lump,
320 * b=10667: ignore -EEXIST.
321 * Silently eat error on setting trusted.lov/lustre.lov
322 * attribute for platforms that added the default option
323 * to copy all attributes in 'cp' command. Both rsync and
324 * tar --xattrs also will try to set LOVEA for existing
329 } else if (S_ISDIR(inode->i_mode)) {
330 if (size != 0 && size < sizeof(struct lov_user_md))
333 rc = ll_dir_setstripe(inode, lump, 0);
339 #ifndef HAVE_USER_NAMESPACE_ARG
340 #define ll_xattr_set(hd, ns, de, inode, name, value, size, flags) \
341 ll_xattr_set(hd, de, inode, name, value, size, flags)
344 static int ll_xattr_set(const struct xattr_handler *handler,
345 struct user_namespace *mnt_userns,
346 struct dentry *dentry, struct inode *inode,
347 const char *name, const void *value, size_t size,
350 ktime_t kstart = ktime_get();
351 int op_type = flags == XATTR_REPLACE ? LPROC_LL_REMOVEXATTR :
358 CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n",
359 PFID(ll_inode2fid(inode)), inode, name);
361 /* lustre/trusted.lov.xxx would be passed through xattr API */
362 if (!strcmp(name, "lov")) {
363 rc = ll_setstripe_ea(dentry, (struct lov_user_md *)value,
365 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
366 ktime_us_delta(ktime_get(), kstart));
368 } else if (!strcmp(name, "lma") || !strcmp(name, "link")) {
369 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
370 ktime_us_delta(ktime_get(), kstart));
374 if (strncmp(name, "lov.", 4) == 0 &&
375 (__swab32(((struct lov_user_md *)value)->lmm_magic) &
376 le32_to_cpu(LOV_MAGIC_MASK)) == le32_to_cpu(LOV_MAGIC_MAGIC))
377 lustre_swab_lov_user_md((struct lov_user_md *)value, 0);
379 return ll_xattr_set_common(handler, mnt_userns, dentry, inode, name,
383 int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
384 size_t size, u64 valid)
386 struct ll_inode_info *lli = ll_i2info(inode);
387 struct ll_sb_info *sbi = ll_i2sbi(inode);
388 struct ptlrpc_request *req = NULL;
393 /* This check is required for compatibility with 2.14, in which
394 * encryption context is stored in security.c xattr. Accessing the
395 * encryption context should only be possible by llcrypt.
397 if (type == XATTR_SECURITY_T && strcmp(name, "security.c") == 0)
398 GOTO(out_xattr, rc = -EPERM);
400 if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
401 (type != XATTR_SECURITY_T || !ll_xattr_is_seclabel(name)) &&
402 (type != XATTR_TRUSTED_T || strcmp(name, XATTR_NAME_SOM))) {
403 rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
405 goto getxattr_nocache;
409 /* Add "system.posix_acl_access" to the list */
410 if (lli->lli_posix_acl && valid & OBD_MD_FLXATTRLS) {
412 rc += sizeof(XATTR_NAME_ACL_ACCESS);
413 } else if (size - rc >= sizeof(XATTR_NAME_ACL_ACCESS)) {
414 memcpy(buffer + rc, XATTR_NAME_ACL_ACCESS,
415 sizeof(XATTR_NAME_ACL_ACCESS));
416 rc += sizeof(XATTR_NAME_ACL_ACCESS);
418 GOTO(out_xattr, rc = -ERANGE);
423 rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid,
428 /* only detect the xattr size */
433 GOTO(out, rc = -ERANGE);
435 /* do not need swab xattr data */
436 xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
439 GOTO(out, rc = -EPROTO);
441 memcpy(buffer, xdata, rc);
447 if (rc == -EOPNOTSUPP && type == XATTR_USER_T) {
448 LCONSOLE_INFO("%s: disabling user_xattr feature because "
449 "it is not supported on the server: rc = %d\n",
451 clear_bit(LL_SBI_USER_XATTR, sbi->ll_flags);
454 ptlrpc_req_finished(req);
458 static int ll_xattr_get_common(const struct xattr_handler *handler,
459 struct dentry *dentry,
461 const char *name, void *buffer, size_t size)
463 struct ll_sb_info *sbi = ll_i2sbi(inode);
464 ktime_t kstart = ktime_get();
470 rc = xattr_type_filter(sbi, handler);
474 rc = ll_security_secctx_name_filter(sbi, handler->flags, name);
478 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
479 /* posix acl is under protection of LOOKUP lock. when calling to this,
480 * we just have path resolution to the target inode, so we have great
481 * chance that cached ACL is uptodate.
483 if (handler->flags == XATTR_ACL_ACCESS_T) {
484 struct ll_inode_info *lli = ll_i2info(inode);
485 struct posix_acl *acl;
487 read_lock(&lli->lli_lock);
488 acl = posix_acl_dup(lli->lli_posix_acl);
489 read_unlock(&lli->lli_lock);
494 rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
495 posix_acl_release(acl);
498 if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
502 fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
506 rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size,
509 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR,
510 ktime_us_delta(ktime_get(), kstart));
515 static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size)
519 if (S_ISREG(inode->i_mode)) {
520 struct cl_object *obj = ll_i2info(inode)->lli_clob;
521 struct cl_layout cl = {
522 .cl_buf.lb_buf = buf,
523 .cl_buf.lb_len = buf_size,
531 env = cl_env_get(&refcheck);
533 RETURN(PTR_ERR(env));
535 rc = cl_object_layout_get(env, obj, &cl);
540 GOTO(out_env, rc = -ENODATA);
547 LASSERT(buf && rc <= buf_size);
550 * Do not return layout gen for getxattr() since
551 * otherwise it would confuse tar --xattr by
552 * recognizing layout gen as stripe offset when the
553 * file is restored. See LU-2809.
555 if ((((struct lov_mds_md *)buf)->lmm_magic &
556 __swab32(LOV_MAGIC_MAGIC)) == __swab32(LOV_MAGIC_MAGIC))
557 lustre_swab_lov_user_md((struct lov_user_md *)buf,
560 switch (((struct lov_mds_md *)buf)->lmm_magic) {
563 case LOV_MAGIC_SPECIFIC:
564 ((struct lov_mds_md *)buf)->lmm_layout_gen = 0;
566 case LOV_MAGIC_COMP_V1:
567 case LOV_MAGIC_FOREIGN:
570 CERROR("Invalid LOV magic %08x\n",
571 ((struct lov_mds_md *)buf)->lmm_magic);
572 GOTO(out_env, rc = -EINVAL);
576 cl_env_put(env, &refcheck);
579 } else if (S_ISDIR(inode->i_mode)) {
580 struct ptlrpc_request *req = NULL;
581 struct ptlrpc_request *root_req = NULL;
582 struct lov_mds_md *lmm = NULL;
585 rc = ll_dir_getstripe_default(inode, (void **)&lmm, &lmm_size,
591 GOTO(out_req, rc = lmm_size);
593 if (buf_size < lmm_size)
594 GOTO(out_req, rc = -ERANGE);
596 memcpy(buf, lmm, lmm_size);
597 GOTO(out_req, rc = lmm_size);
600 ptlrpc_req_finished(req);
602 ptlrpc_req_finished(root_req);
610 static int ll_xattr_get(const struct xattr_handler *handler,
611 struct dentry *dentry, struct inode *inode,
612 const char *name, void *buffer, size_t size)
617 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
618 PFID(ll_inode2fid(inode)), inode, name);
620 if (!strcmp(name, "lov")) {
621 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1);
623 return ll_getxattr_lov(inode, buffer, size);
626 return ll_xattr_get_common(handler, dentry, inode, name, buffer, size);
629 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
631 struct inode *inode = dentry->d_inode;
632 struct ll_sb_info *sbi = ll_i2sbi(inode);
633 ktime_t kstart = ktime_get();
640 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
641 PFID(ll_inode2fid(inode)), inode);
643 rc = ll_xattr_list(inode, NULL, XATTR_OTHER_T, buffer, size,
649 * If we're being called to get the size of the xattr list
650 * (size == 0) then just assume that a lustre.lov xattr
660 const struct xattr_handler *xh = get_xattr_type(xattr_name);
661 bool hide_xattr = false;
663 /* Hide virtual project id xattr from the list when
664 * parent has the inherit flag and the same project id,
665 * so project id won't be messed up by copying the xattrs
666 * when mv to a tree with different project id.
668 if (xh && xh->flags == XATTR_TRUSTED_T &&
669 strcmp(xattr_name, XATTR_NAME_PROJID) == 0) {
670 struct inode *dir = d_inode(dentry->d_parent);
672 if ((ll_i2info(inode)->lli_projid ==
673 ll_i2info(dir)->lli_projid) &&
674 test_bit(LLIF_PROJECT_INHERIT,
675 &ll_i2info(dir)->lli_flags))
677 } else if (xh && xh->flags == XATTR_SECURITY_T &&
678 strcmp(xattr_name, "security.c") == 0) {
679 /* Listing xattrs should not expose encryption
680 * context. There is no handler defined for
681 * XATTR_ENCRYPTION_PREFIX, so this test is just
682 * needed for compatibility with 2.14, in which
683 * encryption context is stored in security.c xattr.
688 len = strnlen(xattr_name, rem - 1) + 1;
690 if (!xattr_type_filter(sbi, hide_xattr ? NULL : xh)) {
691 /* Skip OK xattr type, leave it in buffer. */
697 * Move up remaining xattrs in buffer
698 * removing the xattr that is not OK.
700 memmove(xattr_name, xattr_name + len, rem);
704 rc2 = ll_getxattr_lov(inode, NULL, 0);
711 if (size < rc + sizeof(XATTR_LUSTRE_LOV))
714 memcpy(buffer + rc, XATTR_LUSTRE_LOV, sizeof(XATTR_LUSTRE_LOV));
717 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR,
718 ktime_us_delta(ktime_get(), kstart));
720 RETURN(rc + sizeof(XATTR_LUSTRE_LOV));
723 #ifdef HAVE_XATTR_HANDLER_SIMPLIFIED
724 static int ll_xattr_get_common_4_3(const struct xattr_handler *handler,
725 struct dentry *dentry, const char *name,
726 void *buffer, size_t size)
728 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
732 static int ll_xattr_get_4_3(const struct xattr_handler *handler,
733 struct dentry *dentry, const char *name,
734 void *buffer, size_t size)
736 return ll_xattr_get(handler, dentry, dentry->d_inode, name, buffer,
740 static int ll_xattr_set_common_4_3(const struct xattr_handler *handler,
741 struct dentry *dentry, const char *name,
742 const void *value, size_t size, int flags)
744 return ll_xattr_set_common(handler, dentry, dentry->d_inode, name,
748 static int ll_xattr_set_4_3(const struct xattr_handler *handler,
749 struct dentry *dentry, const char *name,
750 const void *value, size_t size, int flags)
752 return ll_xattr_set(handler, dentry, dentry->d_inode, name, value,
756 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
757 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
758 const struct xattr_handler *get_xattr_handler(int handler_flag)
762 while (ll_xattr_handlers[i]) {
763 if (ll_xattr_handlers[i]->flags == handler_flag)
764 return ll_xattr_handlers[i];
770 static int ll_xattr_get_common_3_11(struct dentry *dentry, const char *name,
771 void *buffer, size_t size, int handler_flags)
773 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
778 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
782 static int ll_xattr_get_3_11(struct dentry *dentry, const char *name,
783 void *buffer, size_t size, int handler_flags)
785 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
790 return ll_xattr_get(handler, dentry, dentry->d_inode, name, buffer,
794 static int ll_xattr_set_common_3_11(struct dentry *dentry, const char *name,
795 const void *value, size_t size, int flags,
798 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
803 return ll_xattr_set_common(handler, NULL, dentry, dentry->d_inode, name,
807 static int ll_xattr_set_3_11(struct dentry *dentry, const char *name,
808 const void *value, size_t size, int flags,
811 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
816 return ll_xattr_set(handler, NULL, dentry, dentry->d_inode, name, value,
821 static const struct xattr_handler ll_user_xattr_handler = {
822 .prefix = XATTR_USER_PREFIX,
823 .flags = XATTR_USER_T,
824 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
825 .get = ll_xattr_get_common_4_3,
826 .set = ll_xattr_set_common_4_3,
827 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
828 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
829 .get = ll_xattr_get_common_3_11,
830 .set = ll_xattr_set_common_3_11,
832 .get = ll_xattr_get_common,
833 .set = ll_xattr_set_common,
837 static const struct xattr_handler ll_trusted_xattr_handler = {
838 .prefix = XATTR_TRUSTED_PREFIX,
839 .flags = XATTR_TRUSTED_T,
840 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
841 .get = ll_xattr_get_4_3,
842 .set = ll_xattr_set_4_3,
843 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
844 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
845 .get = ll_xattr_get_3_11,
846 .set = ll_xattr_set_3_11,
853 static const struct xattr_handler ll_security_xattr_handler = {
854 .prefix = XATTR_SECURITY_PREFIX,
855 .flags = XATTR_SECURITY_T,
856 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
857 .get = ll_xattr_get_common_4_3,
858 .set = ll_xattr_set_common_4_3,
859 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
860 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
861 .get = ll_xattr_get_common_3_11,
862 .set = ll_xattr_set_common_3_11,
864 .get = ll_xattr_get_common,
865 .set = ll_xattr_set_common,
869 static const struct xattr_handler ll_acl_access_xattr_handler = {
870 #ifdef HAVE_XATTR_HANDLER_NAME
871 .name = XATTR_NAME_POSIX_ACL_ACCESS,
873 .prefix = XATTR_NAME_POSIX_ACL_ACCESS,
875 .flags = XATTR_ACL_ACCESS_T,
876 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
877 .get = ll_xattr_get_common_4_3,
878 .set = ll_xattr_set_common_4_3,
879 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
880 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
881 .get = ll_xattr_get_common_3_11,
882 .set = ll_xattr_set_common_3_11,
884 .get = ll_xattr_get_common,
885 .set = ll_xattr_set_common,
889 static const struct xattr_handler ll_acl_default_xattr_handler = {
890 #ifdef HAVE_XATTR_HANDLER_NAME
891 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
893 .prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
895 .flags = XATTR_ACL_DEFAULT_T,
896 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
897 .get = ll_xattr_get_common_4_3,
898 .set = ll_xattr_set_common_4_3,
899 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
900 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
901 .get = ll_xattr_get_common_3_11,
902 .set = ll_xattr_set_common_3_11,
904 .get = ll_xattr_get_common,
905 .set = ll_xattr_set_common,
909 static const struct xattr_handler ll_lustre_xattr_handler = {
910 .prefix = XATTR_LUSTRE_PREFIX,
911 .flags = XATTR_LUSTRE_T,
912 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
913 .get = ll_xattr_get_4_3,
914 .set = ll_xattr_set_4_3,
915 #elif !defined(HAVE_USER_NAMESPACE_ARG) && \
916 !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
917 .get = ll_xattr_get_3_11,
918 .set = ll_xattr_set_3_11,
925 const struct xattr_handler *ll_xattr_handlers[] = {
926 &ll_user_xattr_handler,
927 &ll_trusted_xattr_handler,
928 &ll_security_xattr_handler,
929 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
930 &ll_acl_access_xattr_handler,
931 &ll_acl_default_xattr_handler,
933 &ll_lustre_xattr_handler,