Whamcloud - gitweb
LU-3157 llite: A not locked mutex can be unlocked.
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_internal.h
index a922afc..06f519b 100644 (file)
@@ -1,9 +1,9 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * Modified from NFSv4 project for Lustre
  *
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  *
  * Author: Eric Mei <ericm@clusterfs.com>
  */
@@ -106,9 +106,9 @@ enum ptlrpc_gss_proc {
 };
 
 enum ptlrpc_gss_tgt {
-        LUSTRE_GSS_TGT_MDS              = 0,
-        LUSTRE_GSS_TGT_OSS              = 1,
-        LUSTRE_GSS_TGT_MGS              = 2,
+        LUSTRE_GSS_TGT_MGS              = 0,
+        LUSTRE_GSS_TGT_MDS              = 1,
+        LUSTRE_GSS_TGT_OSS              = 2,
 };
 
 enum ptlrpc_gss_header_flags {
@@ -121,6 +121,8 @@ __u32 import_to_gss_svc(struct obd_import *imp)
 {
         const char *name = imp->imp_obd->obd_type->typ_name;
 
+        if (!strcmp(name, LUSTRE_MGC_NAME))
+                return LUSTRE_GSS_TGT_MGS;
         if (!strcmp(name, LUSTRE_MDC_NAME))
                 return LUSTRE_GSS_TGT_MDS;
         if (!strcmp(name, LUSTRE_OSC_NAME))
@@ -205,7 +207,7 @@ static inline __u64 gss_handle_to_u64(rawobj_t *handle)
                                          GSS_SEQ_WIN_MAIN / 4)
 
 struct gss_svc_seq_data {
-        spinlock_t              ssd_lock;
+       spinlock_t              ssd_lock;
         /*
          * highest sequence number seen so far, for main and back window
          */
@@ -230,6 +232,7 @@ struct gss_svc_ctx {
         uid_t                   gsc_mapped_uid;
         unsigned int            gsc_usr_root:1,
                                 gsc_usr_mds:1,
+                                gsc_usr_oss:1,
                                 gsc_remote:1,
                                 gsc_reverse:1;
 };
@@ -262,7 +265,7 @@ struct gss_cli_ctx {
         __u32                   gc_flavor;
         __u32                   gc_proc;
         __u32                   gc_win;
-        atomic_t                gc_seq;
+        cfs_atomic_t            gc_seq;
         rawobj_t                gc_handle;
         struct gss_ctx         *gc_mechctx;
         /* handle for the buddy svc ctx */
@@ -276,16 +279,16 @@ struct gss_cli_ctx_keyring {
 };
 
 struct gss_sec {
-        struct ptlrpc_sec       gs_base;
-        struct gss_api_mech    *gs_mech;
-        spinlock_t              gs_lock;
-        __u64                   gs_rvs_hdl;
+       struct ptlrpc_sec       gs_base;
+       struct gss_api_mech     *gs_mech;
+       spinlock_t              gs_lock;
+       __u64                   gs_rvs_hdl;
 };
 
 struct gss_sec_pipefs {
         struct gss_sec          gsp_base;
         int                     gsp_chash_size;  /* must be 2^n */
-        struct hlist_head       gsp_chash[0];
+        cfs_hlist_head_t        gsp_chash[0];
 };
 
 /*
@@ -298,7 +301,7 @@ struct gss_sec_keyring {
         /*
          * all contexts listed here. access is protected by sec spinlock.
          */
-        struct hlist_head       gsk_clist;
+        cfs_hlist_head_t        gsk_clist;
         /*
          * specially point to root ctx (only one at a time). access is
          * protected by sec spinlock.
@@ -307,10 +310,10 @@ struct gss_sec_keyring {
         /*
          * specially serialize upcalls for root context.
          */
-        struct mutex            gsk_root_uc_lock;
+       struct mutex                    gsk_root_uc_lock;
 
 #ifdef HAVE_KEYRING_UPCALL_SERIALIZED
-        struct mutex            gsk_uc_lock;        /* serialize upcalls */
+       struct mutex            gsk_uc_lock;    /* serialize upcalls */
 #endif
 };
 
@@ -398,7 +401,8 @@ int cli_ctx_check_death(struct ptlrpc_cli_ctx *ctx);
 int gss_copy_rvc_cli_ctx(struct ptlrpc_cli_ctx *cli_ctx,
                          struct ptlrpc_svc_ctx *svc_ctx);
 
-struct gss_header *gss_swab_header(struct lustre_msg *msg, int segment);
+struct gss_header *gss_swab_header(struct lustre_msg *msg, int segment,
+                                   int swabbed);
 netobj_t *gss_swab_netobj(struct lustre_msg *msg, int segment);
 
 void gss_cli_ctx_uptodate(struct gss_cli_ctx *gctx);
@@ -431,12 +435,16 @@ int  __init gss_init_pipefs(void);
 void __exit gss_exit_pipefs(void);
 
 /* gss_bulk.c */
+int gss_cli_prep_bulk(struct ptlrpc_request *req,
+                      struct ptlrpc_bulk_desc *desc);
 int gss_cli_ctx_wrap_bulk(struct ptlrpc_cli_ctx *ctx,
                           struct ptlrpc_request *req,
                           struct ptlrpc_bulk_desc *desc);
 int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                             struct ptlrpc_request *req,
                             struct ptlrpc_bulk_desc *desc);
+int gss_svc_prep_bulk(struct ptlrpc_request *req,
+                      struct ptlrpc_bulk_desc *desc);
 int gss_svc_unwrap_bulk(struct ptlrpc_request *req,
                         struct ptlrpc_bulk_desc *desc);
 int gss_svc_wrap_bulk(struct ptlrpc_request *req,
@@ -504,14 +512,14 @@ void __dbg_memdump(char *name, void *ptr, int size)
 
         OBD_ALLOC(buf, bufsize);
         if (!buf) {
-                printk("DUMP ERROR: can't alloc %d bytes\n", bufsize);
+                CDEBUG(D_ERROR, "DUMP ERROR: can't alloc %d bytes\n", bufsize);
                 return;
         }
 
         for (i = 0; i < size; i++)
                 sprintf(&buf[i+i], "%02x", (__u8) p[i]);
         buf[size + size] = '\0';
-        printk("DUMP %s@%p(%d): %s\n", name, ptr, size, buf);
+        LCONSOLE_INFO("DUMP %s@%p(%d): %s\n", name, ptr, size, buf);
         OBD_FREE(buf, bufsize);
 }