Whamcloud - gitweb
LU-1303 lod: introduce lod device
[fs/lustre-release.git] / lustre / ptlrpc / sec.c
index d2536c5..315e99a 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, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,9 +38,6 @@
  * Author: Eric Mei <ericm@clusterfs.com>
  */
 
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_SEC
 
 #include <libcfs/libcfs.h>
@@ -120,7 +117,7 @@ EXPORT_SYMBOL(sptlrpc_unregister_policy);
 static
 struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 {
-        static CFS_DECLARE_MUTEX(load_mutex);
+        static CFS_DEFINE_MUTEX(load_mutex);
         static cfs_atomic_t       loaded = CFS_ATOMIC_INIT(0);
         struct ptlrpc_sec_policy *policy;
         __u16                     number = SPTLRPC_FLVR_POLICY(flavor);
@@ -143,7 +140,7 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
                         break;
 
                 /* try to load gss module, once */
-                cfs_mutex_down(&load_mutex);
+                cfs_mutex_lock(&load_mutex);
                 if (cfs_atomic_read(&loaded) == 0) {
                         if (cfs_request_module("ptlrpc_gss") == 0)
                                 CDEBUG(D_SEC,
@@ -153,7 +150,7 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 
                         cfs_atomic_set(&loaded, 1);
                 }
-                cfs_mutex_up(&load_mutex);
+                cfs_mutex_unlock(&load_mutex);
         }
 
         return policy;
@@ -825,6 +822,7 @@ void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int opcode)
         case OST_READ:
         case MDS_READPAGE:
         case MGS_CONFIG_READ:
+       case OBD_IDX_READ:
                 req->rq_bulk_read = 1;
                 break;
         case OST_WRITE:
@@ -1478,7 +1476,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                        sptlrpc_flavor2name(&sf, str, sizeof(str)));
         }
 
-        cfs_mutex_down(&imp->imp_sec_mutex);
+        cfs_mutex_lock(&imp->imp_sec_mutex);
 
         newsec = sptlrpc_sec_create(imp, svc_ctx, &sf, sp);
         if (newsec) {
@@ -1490,7 +1488,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                 rc = -EPERM;
         }
 
-        cfs_mutex_up(&imp->imp_sec_mutex);
+        cfs_mutex_unlock(&imp->imp_sec_mutex);
 out:
         sptlrpc_sec_put(sec);
         RETURN(rc);
@@ -2111,7 +2109,7 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen)
         rc = policy->sp_sops->alloc_rs(req, msglen);
         if (unlikely(rc == -ENOMEM)) {
                 /* failed alloc, try emergency pool */
-                rs = lustre_get_emerg_rs(req->rq_rqbd->rqbd_service);
+               rs = lustre_get_emerg_rs(req->rq_rqbd->rqbd_svcpt);
                 if (rs == NULL)
                         RETURN(-ENOMEM);
 
@@ -2299,6 +2297,7 @@ int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req,
 }
 EXPORT_SYMBOL(sptlrpc_cli_unwrap_bulk_write);
 
+#ifdef HAVE_SERVER_SUPPORT
 /**
  * Performe transformation upon outgoing bulk read.
  */
@@ -2380,6 +2379,8 @@ int sptlrpc_svc_prep_bulk(struct ptlrpc_request *req,
 }
 EXPORT_SYMBOL(sptlrpc_svc_prep_bulk);
 
+#endif /* HAVE_SERVER_SUPPORT */
+
 /****************************************
  * user descriptor helpers              *
  ****************************************/