X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fxattr.c;h=b8500df8bcef34443c0e2cffeb16b33ca212d691;hb=39e5bfa73414d18738001761b42ea0e3264c2983;hp=1bf2819c27704c2f30c6b1db23a5cef55cc22753;hpb=d93aa0171a25f8ffca51bed35a2d477a45fda0f3;p=fs%2Flustre-release.git diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index 1bf2819..b8500df 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -34,7 +34,9 @@ #include #include #include +#ifdef HAVE_LINUX_SELINUX_IS_ENABLED #include +#endif #define DEBUG_SUBSYSTEM S_LLITE @@ -52,6 +54,17 @@ static inline const char *xattr_prefix(const struct xattr_handler *handler) } #endif +#ifdef HAVE_LINUX_SELINUX_IS_ENABLED +# define test_xattr_is_selinux_disabled(handler, name) \ + ((handler)->flags == XATTR_SECURITY_T && \ + !selinux_is_enabled() && \ + strcmp((name), "selinux") == 0) +#else +# define test_xattr_is_selinux_disabled(handler, name) \ + ((handler)->flags == XATTR_SECURITY_T && \ + strcmp((name), "selinux") == 0) +#endif + const struct xattr_handler *get_xattr_type(const char *name) { int i; @@ -135,8 +148,7 @@ static int ll_xattr_set_common(const struct xattr_handler *handler, RETURN(0); /* LU-549: Disable security.selinux when selinux is disabled */ - if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() && - strcmp(name, "selinux") == 0) + if (test_xattr_is_selinux_disabled(handler, name)) RETURN(-EOPNOTSUPP); /* @@ -424,8 +436,7 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, RETURN(rc); /* LU-549: Disable security.selinux when selinux is disabled */ - if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() && - !strcmp(name, "selinux")) + if (test_xattr_is_selinux_disabled(handler, name)) RETURN(-EOPNOTSUPP); #ifdef CONFIG_FS_POSIX_ACL