* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <lustre_param.h>
#include "llite_internal.h"
-cfs_mem_cache_t *ll_remote_perm_cachep = NULL;
-cfs_mem_cache_t *ll_rmtperm_hash_cachep = NULL;
+struct kmem_cache *ll_remote_perm_cachep;
+struct kmem_cache *ll_rmtperm_hash_cachep;
static inline struct ll_remote_perm *alloc_ll_remote_perm(void)
{
struct ll_remote_perm *lrp;
- OBD_SLAB_ALLOC_PTR_GFP(lrp, ll_remote_perm_cachep, CFS_ALLOC_KERNEL);
+ OBD_SLAB_ALLOC_PTR_GFP(lrp, ll_remote_perm_cachep, GFP_KERNEL);
if (lrp)
CFS_INIT_HLIST_NODE(&lrp->lrp_list);
return lrp;
OBD_SLAB_ALLOC_GFP(hash, ll_rmtperm_hash_cachep,
REMOTE_PERM_HASHSIZE * sizeof(*hash),
- CFS_ALLOC_STD);
+ GFP_IOFS);
if (!hash)
return NULL;
int found = 0, rc;
ENTRY;
- if (!lli->lli_remote_perms)
- RETURN(-ENOENT);
+ if (!lli->lli_remote_perms)
+ RETURN(-ENOENT);
- head = lli->lli_remote_perms + remote_perm_hashfunc(cfs_curproc_uid());
+ head = lli->lli_remote_perms + remote_perm_hashfunc(current_uid());
spin_lock(&lli->lli_lock);
- cfs_hlist_for_each_entry(lrp, node, head, lrp_list) {
- if (lrp->lrp_uid != cfs_curproc_uid())
- continue;
- if (lrp->lrp_gid != cfs_curproc_gid())
- continue;
- if (lrp->lrp_fsuid != cfs_curproc_fsuid())
- continue;
- if (lrp->lrp_fsgid != cfs_curproc_fsgid())
- continue;
- found = 1;
- break;
- }
+ cfs_hlist_for_each_entry(lrp, node, head, lrp_list) {
+ if (lrp->lrp_uid != current_uid())
+ continue;
+ if (lrp->lrp_gid != current_gid())
+ continue;
+ if (lrp->lrp_fsuid != current_fsuid())
+ continue;
+ if (lrp->lrp_fsgid != current_fsgid())
+ continue;
+ found = 1;
+ break;
+ }
if (!found)
GOTO(out, rc = -ENOENT);
int i = 0, rc;
ENTRY;
- do {
- save = lli->lli_rmtperm_time;
- rc = do_check_remote_perm(lli, mask);
- if (!rc || (rc != -ENOENT && i))
- break;
+ do {
+ save = lli->lli_rmtperm_time;
+ rc = do_check_remote_perm(lli, mask);
+ if (!rc || (rc != -ENOENT && i))
+ break;
- cfs_might_sleep();
+ might_sleep();
mutex_lock(&lli->lli_rmtperm_mutex);
- /* check again */
- if (save != lli->lli_rmtperm_time) {
- rc = do_check_remote_perm(lli, mask);
- if (!rc || (rc != -ENOENT && i)) {
+ /* check again */
+ if (save != lli->lli_rmtperm_time) {
+ rc = do_check_remote_perm(lli, mask);
+ if (!rc || (rc != -ENOENT && i)) {
mutex_unlock(&lli->lli_rmtperm_mutex);
- break;
- }
- }
+ break;
+ }
+ }
if (i++ > 5) {
CERROR("check remote perm falls in dead loop!\n");