Whamcloud - gitweb
LU-549 llite: Improve statfs performance if selinux is disabled
[fs/lustre-release.git] / lustre / llite / xattr.c
index 94b48bf..863f98b 100644 (file)
@@ -28,6 +28,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,6 +40,9 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/smp_lock.h>
+#ifdef HAVE_SELINUX_IS_ENABLED
+#include <linux/selinux.h>
+#endif
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
@@ -45,7 +50,6 @@
 #include <lustre_lite.h>
 #include <lustre_dlm.h>
 #include <lustre_ver.h>
-//#include <lustre_mdc.h>
 #include <lustre_acl.h>
 
 #include "llite_internal.h"
@@ -94,6 +98,8 @@ int xattr_type_filter(struct ll_sb_info *sbi, int xattr_type)
            !(sbi->ll_flags & LL_SBI_ACL))
                 return -EOPNOTSUPP;
 
+        if (xattr_type == XATTR_SECURITY_T && !selinux_is_enabled())
+                return -EOPNOTSUPP;
         if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
                 return -EOPNOTSUPP;
         if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
@@ -509,10 +515,7 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
                 GOTO(out, rc);
 
         if (S_ISREG(inode->i_mode)) {
-                struct ll_inode_info *lli = ll_i2info(inode);
-                struct lov_stripe_md *lsm = NULL;
-                lsm = lli->lli_smd;
-                if (lsm == NULL)
+                if (ll_i2info(inode)->lli_smd == NULL)
                         rc2 = -1;
         } else if (S_ISDIR(inode->i_mode)) {
                 rc2 = ll_dir_getstripe(inode, &lmm, &lmmsize, &request);