Whamcloud - gitweb
LU-837 release semaphore for error case in gss_do_ctx_init_rpc
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_cli_upcall.c
index 28a28b7..80d5591 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -49,7 +49,6 @@
 #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/mutex.h>
-#include <linux/random.h>
 #else
 #include <liblustre.h>
 #endif
@@ -92,6 +91,7 @@ int ctx_init_pack_request(struct obd_import *imp,
         /* gss hdr */
         ghdr = lustre_msg_buf(msg, 0, sizeof(*ghdr));
         ghdr->gh_version = PTLRPC_GSS_VERSION;
+        ghdr->gh_sp = (__u8) imp->imp_sec->ps_part;
         ghdr->gh_flags = 0;
         ghdr->gh_proc = PTLRPC_GSS_PROC_INIT;
         ghdr->gh_seq = 0;
@@ -299,6 +299,7 @@ int gss_do_ctx_init_rpc(__user char *buffer, unsigned long count)
         cfs_down_read(&obd->u.cli.cl_sem);
         if (obd->u.cli.cl_import == NULL) {
                 CERROR("obd %s: import has gone\n", obd->obd_name);
+                cfs_up_read(&obd->u.cli.cl_sem);
                 RETURN(-EINVAL);
         }
         imp = class_import_get(obd->u.cli.cl_import);