Whamcloud - gitweb
LU-1403 ucred: ucred cleanup
[fs/lustre-release.git] / lustre / mdt / mdt_identity.c
index 59a5535..e8612d1 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
  * Author: Fan Yong <fanyong@clusterfs.com>
  */
 
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDS
 
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -56,7 +50,6 @@
 #include <linux/errno.h>
 #include <linux/version.h>
 #include <linux/unistd.h>
-#include <asm/system.h>
 #include <asm/uaccess.h>
 #include <linux/fs.h>
 #include <linux/stat.h>
@@ -121,7 +114,7 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
         /* There is race condition:
          * "uc_upcall" was changed just after "is_identity_get_disabled" check.
          */
-        cfs_read_lock(&cache->uc_upcall_rwlock);
+       read_lock(&cache->uc_upcall_rwlock);
         CDEBUG(D_INFO, "The upcall is: '%s'\n", cache->uc_upcall);
 
         if (unlikely(!strcmp(cache->uc_upcall, "NONE"))) {
@@ -149,7 +142,7 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache,
         }
         EXIT;
 out:
-        cfs_read_unlock(&cache->uc_upcall_rwlock);
+       read_unlock(&cache->uc_upcall_rwlock);
         return rc;
 }
 
@@ -284,7 +277,7 @@ __u32 mdt_identity_get_perm(struct md_identity *identity,
 int mdt_pack_remote_perm(struct mdt_thread_info *info, struct mdt_object *o,
                          void *buf)
 {
-        struct md_ucred         *uc = mdt_ucred(info);
+       struct lu_ucred         *uc = mdt_ucred_check(info);
         struct md_object        *next = mdt_object_child(o);
         struct mdt_remote_perm  *perm = buf;
 
@@ -296,13 +289,13 @@ int mdt_pack_remote_perm(struct mdt_thread_info *info, struct mdt_object *o,
         if (!exp_connect_rmtclient(info->mti_exp))
                 RETURN(-EBADE);
 
-        if ((uc->mu_valid != UCRED_OLD) && (uc->mu_valid != UCRED_NEW))
-                RETURN(-EINVAL);
+       if (uc == NULL)
+               RETURN(-EINVAL);
 
-        perm->rp_uid = uc->mu_o_uid;
-        perm->rp_gid = uc->mu_o_gid;
-        perm->rp_fsuid = uc->mu_o_fsuid;
-        perm->rp_fsgid = uc->mu_o_fsgid;
+       perm->rp_uid = uc->uc_o_uid;
+       perm->rp_gid = uc->uc_o_gid;
+       perm->rp_fsuid = uc->uc_o_fsuid;
+       perm->rp_fsgid = uc->uc_o_fsgid;
 
         perm->rp_access_perm = 0;
         if (mo_permission(info->mti_env, NULL, next, NULL, MAY_READ) == 0)