Whamcloud - gitweb
LU-5614 build: use %kernel_module_package in rpm spec
[fs/lustre-release.git] / lustre / llite / xattr_cache.c
index 763bc77..a619db3 100644 (file)
@@ -24,6 +24,8 @@
 /*
  * Copyright 2012 Xyratex Technology Limited
  *
+ * Copyright (c) 2013, 2015, Intel Corporation.
+ *
  * Author: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
  *
  */
@@ -84,7 +86,7 @@ static void ll_xattr_cache_init(struct ll_inode_info *lli)
        LASSERT(lli != NULL);
 
        INIT_LIST_HEAD(&lli->lli_xattrs);
-       lli->lli_flags |= LLIF_XATTR_CACHE;
+       ll_file_set_flag(lli, LLIF_XATTR_CACHE);
 }
 
 /**
@@ -256,7 +258,7 @@ static int ll_xattr_cache_list(struct list_head *cache,
  */
 static int ll_xattr_cache_valid(struct ll_inode_info *lli)
 {
-       return !!(lli->lli_flags & LLIF_XATTR_CACHE);
+       return ll_file_test_flag(lli, LLIF_XATTR_CACHE);
 }
 
 /**
@@ -275,7 +277,8 @@ static int ll_xattr_cache_destroy_locked(struct ll_inode_info *lli)
 
        while (ll_xattr_cache_del(&lli->lli_xattrs, NULL) == 0)
                /* empty loop */ ;
-       lli->lli_flags &= ~LLIF_XATTR_CACHE;
+
+       ll_file_clear_flag(lli, LLIF_XATTR_CACHE);
 
        RETURN(0);
 }
@@ -309,7 +312,7 @@ static int ll_xattr_find_get_lock(struct inode *inode,
                                  struct lookup_intent *oit,
                                  struct ptlrpc_request **req)
 {
-       ldlm_mode_t mode;
+       enum ldlm_mode mode;
        struct lustre_handle lockh = { 0 };
        struct md_op_data *op_data;
        struct ll_inode_info *lli = ll_i2info(inode);
@@ -334,8 +337,8 @@ static int ll_xattr_find_get_lock(struct inode *inode,
                                        LCK_PR);
                if (mode != 0) {
                        /* fake oit in mdc_revalidate_lock() manner */
-                       oit->d.lustre.it_lock_handle = lockh.cookie;
-                       oit->d.lustre.it_lock_mode = mode;
+                       oit->it_lock_handle = lockh.cookie;
+                       oit->it_lock_mode = mode;
                        goto out;
                }
        }
@@ -360,7 +363,7 @@ static int ll_xattr_find_get_lock(struct inode *inode,
                RETURN(rc);
        }
 
-       *req = (struct ptlrpc_request *)oit->d.lustre.it_data;
+       *req = oit->it_request;
 out:
        down_write(&lli->lli_xattrs_list_rwsem);
        mutex_unlock(&lli->lli_xattrs_enq_lock);
@@ -407,10 +410,10 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit)
                GOTO(out_maybe_drop, rc = -EIO);
        }
 
-       if (oit->d.lustre.it_status < 0) {
+       if (oit->it_status < 0) {
                CDEBUG(D_CACHE, "getxattr intent returned %d for fid "DFID"\n",
-                      oit->d.lustre.it_status, PFID(ll_inode2fid(inode)));
-               rc = oit->d.lustre.it_status;
+                      oit->it_status, PFID(ll_inode2fid(inode)));
+               rc = oit->it_status;
                /* xattr data is so large that we don't want to cache it */
                if (rc == -ERANGE)
                        rc = -EAGAIN;
@@ -458,6 +461,10 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit)
                        CDEBUG(D_CACHE, "not caching %s\n",
                               XATTR_NAME_ACL_ACCESS);
                        rc = 0;
+               } else if (!strcmp(xdata, "security.selinux")) {
+                       /* Filter out security.selinux, it is cached in slab */
+                       CDEBUG(D_CACHE, "not caching security.selinux\n");
+                       rc = 0;
                } else {
                        rc = ll_xattr_cache_add(&lli->lli_xattrs, xdata, xval,
                                                *xsizes);
@@ -492,8 +499,8 @@ out_destroy:
        up_write(&lli->lli_xattrs_list_rwsem);
 
        ldlm_lock_decref_and_cancel((struct lustre_handle *)
-                                       &oit->d.lustre.it_lock_handle,
-                                       oit->d.lustre.it_lock_mode);
+                                       &oit->it_lock_handle,
+                                       oit->it_lock_mode);
 
        goto out_no_unlock;
 }