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 static int ll_xattr_set_common(const struct xattr_handler *handler,
94 struct dentry *dentry, struct inode *inode,
95 const char *name, const void *value, size_t size,
98 struct ll_sb_info *sbi = ll_i2sbi(inode);
99 struct ptlrpc_request *req = NULL;
100 const char *pv = value;
102 ktime_t kstart = ktime_get();
107 /* When setxattr() is called with a size of 0 the value is
108 * unconditionally replaced by "". When removexattr() is
109 * called we get a NULL value and XATTR_REPLACE for flags. */
110 if (!value && flags == XATTR_REPLACE)
111 valid = OBD_MD_FLXATTRRM;
113 valid = OBD_MD_FLXATTR;
115 /* FIXME: enable IMA when the conditions are ready */
116 if (handler->flags == XATTR_SECURITY_T &&
117 (!strcmp(name, "ima") || !strcmp(name, "evm")))
120 rc = xattr_type_filter(sbi, handler);
124 if ((handler->flags == XATTR_ACL_ACCESS_T ||
125 handler->flags == XATTR_ACL_DEFAULT_T) &&
126 !inode_owner_or_capable(inode))
129 /* b10667: ignore lustre special xattr for now */
130 if (!strcmp(name, "hsm") ||
131 ((handler->flags == XATTR_TRUSTED_T && !strcmp(name, "lov")) ||
132 (handler->flags == XATTR_LUSTRE_T && !strcmp(name, "lov"))))
135 /* LU-549: Disable security.selinux when selinux is disabled */
136 if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() &&
137 strcmp(name, "selinux") == 0)
141 * In user.* namespace, only regular files and directories can have
142 * extended attributes.
144 if (handler->flags == XATTR_USER_T) {
145 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
149 /* This check is required for compatibility with 2.14, in which
150 * encryption context is stored in security.c xattr.
151 * Setting the encryption context should only be possible by llcrypt
152 * when defining an encryption policy on a directory.
153 * When new files/dirs are created in an encrypted dir, the enc
154 * context is set directly in the create request.
156 if (handler->flags == XATTR_SECURITY_T && strcmp(name, "c") == 0)
159 fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
163 rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, fullname,
164 pv, size, flags, ll_i2suppgid(inode), &req);
167 if (rc == -EOPNOTSUPP && handler->flags == XATTR_USER_T) {
168 LCONSOLE_INFO("Disabling user_xattr feature because it is not supported on the server\n");
169 clear_bit(LL_SBI_USER_XATTR, sbi->ll_flags);
174 ptlrpc_req_finished(req);
176 ll_stats_ops_tally(ll_i2sbi(inode), valid == OBD_MD_FLXATTRRM ?
177 LPROC_LL_REMOVEXATTR : LPROC_LL_SETXATTR,
178 ktime_us_delta(ktime_get(), kstart));
183 static int get_hsm_state(struct inode *inode, u32 *hus_states)
185 struct md_op_data *op_data;
186 struct hsm_user_state *hus;
193 op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
194 LUSTRE_OPC_ANY, hus);
195 if (!IS_ERR(op_data)) {
196 rc = obd_iocontrol(LL_IOC_HSM_STATE_GET, ll_i2mdexp(inode),
197 sizeof(*op_data), op_data, NULL);
199 *hus_states = hus->hus_states;
201 CDEBUG(D_VFSTRACE, "obd_iocontrol failed. rc = %d\n",
204 ll_finish_md_op_data(op_data);
206 rc = PTR_ERR(op_data);
207 CDEBUG(D_VFSTRACE, "Could not prepare the opdata. rc = %d\n",
214 static int ll_adjust_lum(struct inode *inode, struct lov_user_md *lump, size_t size)
216 struct lov_comp_md_v1 *comp_v1 = (struct lov_comp_md_v1 *)lump;
217 struct lov_user_md *v1 = lump;
218 bool need_clear_release = false;
219 bool release_checked = false;
220 bool is_composite = false;
228 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
229 if (size < sizeof(*comp_v1))
232 entry_count = comp_v1->lcm_entry_count;
233 if (size < offsetof(typeof(*comp_v1), lcm_entries[entry_count]))
238 for (i = 0; i < entry_count; i++) {
239 if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) {
242 if (comp_v1->lcm_entries[i].lcme_offset + sizeof(*v1) >
246 ptr += comp_v1->lcm_entries[i].lcme_offset;
247 v1 = (struct lov_user_md *)ptr;
251 * Attributes that are saved via getxattr will always
252 * have the stripe_offset as 0. Instead, the MDS
253 * should be allowed to pick the starting OST index.
256 if (!is_composite && v1->lmm_stripe_offset == 0)
257 v1->lmm_stripe_offset = -1;
259 /* Avoid anyone directly setting the RELEASED flag. */
260 if (v1->lmm_pattern & LOV_PATTERN_F_RELEASED) {
261 if (!release_checked) {
264 rc = get_hsm_state(inode, &state);
268 if (!(state & HS_ARCHIVED))
269 need_clear_release = true;
270 release_checked = true;
272 if (need_clear_release)
273 v1->lmm_pattern ^= LOV_PATTERN_F_RELEASED;
280 static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump,
283 struct inode *inode = dentry->d_inode;
287 * It is possible to set an xattr to a "" value of zero size.
288 * For this case we are going to treat it as a removal.
293 if (size && size < sizeof(*lump)) {
294 /* ll_adjust_lum() or ll_lov_user_md_size() might access
295 * before size - just give up now.
299 rc = ll_adjust_lum(inode, lump, size);
303 if (lump && S_ISREG(inode->i_mode)) {
304 u64 it_flags = FMODE_WRITE;
307 lum_size = ll_lov_user_md_size(lump);
308 if (lum_size < 0 || size < lum_size)
311 rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags, lump,
314 * b=10667: ignore -EEXIST.
315 * Silently eat error on setting trusted.lov/lustre.lov
316 * attribute for platforms that added the default option
317 * to copy all attributes in 'cp' command. Both rsync and
318 * tar --xattrs also will try to set LOVEA for existing
323 } else if (S_ISDIR(inode->i_mode)) {
324 if (size != 0 && size < sizeof(struct lov_user_md))
327 rc = ll_dir_setstripe(inode, lump, 0);
333 static int ll_xattr_set(const struct xattr_handler *handler,
334 struct dentry *dentry, struct inode *inode,
335 const char *name, const void *value, size_t size,
338 ktime_t kstart = ktime_get();
339 int op_type = flags == XATTR_REPLACE ? LPROC_LL_REMOVEXATTR :
346 CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n",
347 PFID(ll_inode2fid(inode)), inode, name);
349 /* lustre/trusted.lov.xxx would be passed through xattr API */
350 if (!strcmp(name, "lov")) {
351 rc = ll_setstripe_ea(dentry, (struct lov_user_md *)value,
353 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
354 ktime_us_delta(ktime_get(), kstart));
356 } else if (!strcmp(name, "lma") || !strcmp(name, "link")) {
357 ll_stats_ops_tally(ll_i2sbi(inode), op_type,
358 ktime_us_delta(ktime_get(), kstart));
362 if (strncmp(name, "lov.", 4) == 0 &&
363 (__swab32(((struct lov_user_md *)value)->lmm_magic) &
364 le32_to_cpu(LOV_MAGIC_MASK)) == le32_to_cpu(LOV_MAGIC_MAGIC))
365 lustre_swab_lov_user_md((struct lov_user_md *)value, 0);
367 return ll_xattr_set_common(handler, dentry, inode, name, value, size,
371 int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
372 size_t size, u64 valid)
374 struct ll_inode_info *lli = ll_i2info(inode);
375 struct ll_sb_info *sbi = ll_i2sbi(inode);
376 struct ptlrpc_request *req = NULL;
381 /* This check is required for compatibility with 2.14, in which
382 * encryption context is stored in security.c xattr. Accessing the
383 * encryption context should only be possible by llcrypt.
385 if (type == XATTR_SECURITY_T && strcmp(name, "security.c") == 0)
386 GOTO(out_xattr, rc = -EPERM);
388 if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
389 (type != XATTR_SECURITY_T || strcmp(name, "security.selinux"))) {
390 rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
392 goto getxattr_nocache;
396 /* Add "system.posix_acl_access" to the list */
397 if (lli->lli_posix_acl && valid & OBD_MD_FLXATTRLS) {
399 rc += sizeof(XATTR_NAME_ACL_ACCESS);
400 } else if (size - rc >= sizeof(XATTR_NAME_ACL_ACCESS)) {
401 memcpy(buffer + rc, XATTR_NAME_ACL_ACCESS,
402 sizeof(XATTR_NAME_ACL_ACCESS));
403 rc += sizeof(XATTR_NAME_ACL_ACCESS);
405 GOTO(out_xattr, rc = -ERANGE);
410 rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid,
415 /* only detect the xattr size */
420 GOTO(out, rc = -ERANGE);
422 /* do not need swab xattr data */
423 xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
426 GOTO(out, rc = -EPROTO);
428 memcpy(buffer, xdata, rc);
434 if (rc == -EOPNOTSUPP && type == XATTR_USER_T) {
435 LCONSOLE_INFO("%s: disabling user_xattr feature because "
436 "it is not supported on the server: rc = %d\n",
438 clear_bit(LL_SBI_USER_XATTR, sbi->ll_flags);
441 ptlrpc_req_finished(req);
445 static int ll_xattr_get_common(const struct xattr_handler *handler,
446 struct dentry *dentry,
448 const char *name, void *buffer, size_t size)
450 struct ll_sb_info *sbi = ll_i2sbi(inode);
451 ktime_t kstart = ktime_get();
457 rc = xattr_type_filter(sbi, handler);
461 /* LU-549: Disable security.selinux when selinux is disabled */
462 if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() &&
463 !strcmp(name, "selinux"))
466 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
467 /* posix acl is under protection of LOOKUP lock. when calling to this,
468 * we just have path resolution to the target inode, so we have great
469 * chance that cached ACL is uptodate.
471 if (handler->flags == XATTR_ACL_ACCESS_T) {
472 struct ll_inode_info *lli = ll_i2info(inode);
473 struct posix_acl *acl;
475 read_lock(&lli->lli_lock);
476 acl = posix_acl_dup(lli->lli_posix_acl);
477 read_unlock(&lli->lli_lock);
482 rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
483 posix_acl_release(acl);
486 if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
490 fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
494 rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size,
497 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR,
498 ktime_us_delta(ktime_get(), kstart));
503 static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size)
507 if (S_ISREG(inode->i_mode)) {
508 struct cl_object *obj = ll_i2info(inode)->lli_clob;
509 struct cl_layout cl = {
510 .cl_buf.lb_buf = buf,
511 .cl_buf.lb_len = buf_size,
519 env = cl_env_get(&refcheck);
521 RETURN(PTR_ERR(env));
523 rc = cl_object_layout_get(env, obj, &cl);
528 GOTO(out_env, rc = -ENODATA);
535 LASSERT(buf && rc <= buf_size);
538 * Do not return layout gen for getxattr() since
539 * otherwise it would confuse tar --xattr by
540 * recognizing layout gen as stripe offset when the
541 * file is restored. See LU-2809.
543 if ((((struct lov_mds_md *)buf)->lmm_magic &
544 __swab32(LOV_MAGIC_MAGIC)) == __swab32(LOV_MAGIC_MAGIC))
545 lustre_swab_lov_user_md((struct lov_user_md *)buf,
548 switch (((struct lov_mds_md *)buf)->lmm_magic) {
551 case LOV_MAGIC_SPECIFIC:
552 ((struct lov_mds_md *)buf)->lmm_layout_gen = 0;
554 case LOV_MAGIC_COMP_V1:
555 case LOV_MAGIC_FOREIGN:
558 CERROR("Invalid LOV magic %08x\n",
559 ((struct lov_mds_md *)buf)->lmm_magic);
560 GOTO(out_env, rc = -EINVAL);
564 cl_env_put(env, &refcheck);
567 } else if (S_ISDIR(inode->i_mode)) {
568 struct ptlrpc_request *req = NULL;
569 struct ptlrpc_request *root_req = NULL;
570 struct lov_mds_md *lmm = NULL;
573 rc = ll_dir_getstripe_default(inode, (void **)&lmm, &lmm_size,
579 GOTO(out_req, rc = lmm_size);
581 if (buf_size < lmm_size)
582 GOTO(out_req, rc = -ERANGE);
584 memcpy(buf, lmm, lmm_size);
585 GOTO(out_req, rc = lmm_size);
588 ptlrpc_req_finished(req);
590 ptlrpc_req_finished(root_req);
598 static int ll_xattr_get(const struct xattr_handler *handler,
599 struct dentry *dentry, struct inode *inode,
600 const char *name, void *buffer, size_t size)
605 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
606 PFID(ll_inode2fid(inode)), inode, name);
608 if (!strcmp(name, "lov")) {
609 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1);
611 return ll_getxattr_lov(inode, buffer, size);
614 return ll_xattr_get_common(handler, dentry, inode, name, buffer, size);
617 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
619 struct inode *inode = dentry->d_inode;
620 struct ll_sb_info *sbi = ll_i2sbi(inode);
621 ktime_t kstart = ktime_get();
628 CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
629 PFID(ll_inode2fid(inode)), inode);
631 rc = ll_xattr_list(inode, NULL, XATTR_OTHER_T, buffer, size,
637 * If we're being called to get the size of the xattr list
638 * (size == 0) then just assume that a lustre.lov xattr
648 const struct xattr_handler *xh = get_xattr_type(xattr_name);
649 bool hide_xattr = false;
651 /* Hide virtual project id xattr from the list when
652 * parent has the inherit flag and the same project id,
653 * so project id won't be messed up by copying the xattrs
654 * when mv to a tree with different project id.
656 if (xh && xh->flags == XATTR_TRUSTED_T &&
657 strcmp(xattr_name, XATTR_NAME_PROJID) == 0) {
658 struct inode *dir = d_inode(dentry->d_parent);
660 if ((ll_i2info(inode)->lli_projid ==
661 ll_i2info(dir)->lli_projid) &&
662 test_bit(LLIF_PROJECT_INHERIT,
663 &ll_i2info(dir)->lli_flags))
665 } else if (xh && xh->flags == XATTR_SECURITY_T &&
666 strcmp(xattr_name, "security.c") == 0) {
667 /* Listing xattrs should not expose encryption
668 * context. There is no handler defined for
669 * XATTR_ENCRYPTION_PREFIX, so this test is just
670 * needed for compatibility with 2.14, in which
671 * encryption context is stored in security.c xattr.
676 len = strnlen(xattr_name, rem - 1) + 1;
678 if (!xattr_type_filter(sbi, hide_xattr ? NULL : xh)) {
679 /* Skip OK xattr type, leave it in buffer. */
685 * Move up remaining xattrs in buffer
686 * removing the xattr that is not OK.
688 memmove(xattr_name, xattr_name + len, rem);
692 rc2 = ll_getxattr_lov(inode, NULL, 0);
699 if (size < rc + sizeof(XATTR_LUSTRE_LOV))
702 memcpy(buffer + rc, XATTR_LUSTRE_LOV, sizeof(XATTR_LUSTRE_LOV));
705 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR,
706 ktime_us_delta(ktime_get(), kstart));
708 RETURN(rc + sizeof(XATTR_LUSTRE_LOV));
711 #ifdef HAVE_XATTR_HANDLER_SIMPLIFIED
712 static int ll_xattr_get_common_4_3(const struct xattr_handler *handler,
713 struct dentry *dentry, const char *name,
714 void *buffer, size_t size)
716 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
720 static int ll_xattr_get_4_3(const struct xattr_handler *handler,
721 struct dentry *dentry, const char *name,
722 void *buffer, size_t size)
724 return ll_xattr_get(handler, dentry, dentry->d_inode, name, buffer,
728 static int ll_xattr_set_common_4_3(const struct xattr_handler *handler,
729 struct dentry *dentry, const char *name,
730 const void *value, size_t size, int flags)
732 return ll_xattr_set_common(handler, dentry, dentry->d_inode, name,
736 static int ll_xattr_set_4_3(const struct xattr_handler *handler,
737 struct dentry *dentry, const char *name,
738 const void *value, size_t size, int flags)
740 return ll_xattr_set(handler, dentry, dentry->d_inode, name, value,
744 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
745 const struct xattr_handler *get_xattr_handler(int handler_flag)
749 while (ll_xattr_handlers[i]) {
750 if (ll_xattr_handlers[i]->flags == handler_flag)
751 return ll_xattr_handlers[i];
757 static int ll_xattr_get_common_3_11(struct dentry *dentry, const char *name,
758 void *buffer, size_t size, int handler_flags)
760 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
765 return ll_xattr_get_common(handler, dentry, dentry->d_inode, name,
769 static int ll_xattr_get_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(handler, dentry, dentry->d_inode, name, buffer,
781 static int ll_xattr_set_common_3_11(struct dentry *dentry, const char *name,
782 const void *value, size_t size, int flags,
785 const struct xattr_handler *handler = get_xattr_handler(handler_flags);
790 return ll_xattr_set_common(handler, dentry, dentry->d_inode, name,
794 static int ll_xattr_set_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(handler, dentry, dentry->d_inode, name, value,
808 static const struct xattr_handler ll_user_xattr_handler = {
809 .prefix = XATTR_USER_PREFIX,
810 .flags = XATTR_USER_T,
811 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
812 .get = ll_xattr_get_common_4_3,
813 .set = ll_xattr_set_common_4_3,
814 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
815 .get = ll_xattr_get_common_3_11,
816 .set = ll_xattr_set_common_3_11,
818 .get = ll_xattr_get_common,
819 .set = ll_xattr_set_common,
823 static const struct xattr_handler ll_trusted_xattr_handler = {
824 .prefix = XATTR_TRUSTED_PREFIX,
825 .flags = XATTR_TRUSTED_T,
826 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
827 .get = ll_xattr_get_4_3,
828 .set = ll_xattr_set_4_3,
829 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
830 .get = ll_xattr_get_3_11,
831 .set = ll_xattr_set_3_11,
838 static const struct xattr_handler ll_security_xattr_handler = {
839 .prefix = XATTR_SECURITY_PREFIX,
840 .flags = XATTR_SECURITY_T,
841 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
842 .get = ll_xattr_get_common_4_3,
843 .set = ll_xattr_set_common_4_3,
844 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
845 .get = ll_xattr_get_common_3_11,
846 .set = ll_xattr_set_common_3_11,
848 .get = ll_xattr_get_common,
849 .set = ll_xattr_set_common,
853 static const struct xattr_handler ll_acl_access_xattr_handler = {
854 #ifdef HAVE_XATTR_HANDLER_NAME
855 .name = XATTR_NAME_POSIX_ACL_ACCESS,
857 .prefix = XATTR_NAME_POSIX_ACL_ACCESS,
859 .flags = XATTR_ACL_ACCESS_T,
860 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
861 .get = ll_xattr_get_common_4_3,
862 .set = ll_xattr_set_common_4_3,
863 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
864 .get = ll_xattr_get_common_3_11,
865 .set = ll_xattr_set_common_3_11,
867 .get = ll_xattr_get_common,
868 .set = ll_xattr_set_common,
872 static const struct xattr_handler ll_acl_default_xattr_handler = {
873 #ifdef HAVE_XATTR_HANDLER_NAME
874 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
876 .prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
878 .flags = XATTR_ACL_DEFAULT_T,
879 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
880 .get = ll_xattr_get_common_4_3,
881 .set = ll_xattr_set_common_4_3,
882 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
883 .get = ll_xattr_get_common_3_11,
884 .set = ll_xattr_set_common_3_11,
886 .get = ll_xattr_get_common,
887 .set = ll_xattr_set_common,
891 static const struct xattr_handler ll_lustre_xattr_handler = {
892 .prefix = XATTR_LUSTRE_PREFIX,
893 .flags = XATTR_LUSTRE_T,
894 #if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
895 .get = ll_xattr_get_4_3,
896 .set = ll_xattr_set_4_3,
897 #elif !defined(HAVE_XATTR_HANDLER_INODE_PARAM)
898 .get = ll_xattr_get_3_11,
899 .set = ll_xattr_set_3_11,
906 const struct xattr_handler *ll_xattr_handlers[] = {
907 &ll_user_xattr_handler,
908 &ll_trusted_xattr_handler,
909 &ll_security_xattr_handler,
910 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
911 &ll_acl_access_xattr_handler,
912 &ll_acl_default_xattr_handler,
914 &ll_lustre_xattr_handler,