Whamcloud - gitweb
LU-1222 ldlm: Fix the race in AST sender vs multiple arriving RPCs
[fs/lustre-release.git] / lustre / lclient / lcommon_misc.c
index 5b85217..ede03be 100644 (file)
@@ -28,6 +28,8 @@
 /*
  * Copyright (c) 2008, 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/
@@ -56,7 +58,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
         __u32 valsize = sizeof(struct lov_desc);
         int rc, easize, def_easize, cookiesize;
         struct lov_desc desc;
-        __u32 stripes;
+        __u16 stripes;
         ENTRY;
 
         rc = obd_get_info(dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
@@ -136,7 +138,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
         if (IS_ERR(env))
                 return PTR_ERR(env);
 
-        io = &ccc_env_info(env)->cti_io;
+        io = ccc_env_thread_io(env);
         io->ci_obj = obj;
 
         rc = cl_io_init(env, io, CIT_MISC, io->ci_obj);
@@ -163,9 +165,10 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
                 return PTR_ERR(lock);
         }
 
-        cg->cg_env = cl_env_get(&refcheck);
+        cg->cg_env  = cl_env_get(&refcheck);
+        cg->cg_io   = io;
         cg->cg_lock = lock;
-        cg->cg_gid = gid;
+        cg->cg_gid  = gid;
         LASSERT(cg->cg_env == env);
 
         cl_env_unplant(env, &refcheck);
@@ -174,9 +177,10 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
 
 void cl_put_grouplock(struct ccc_grouplock *cg)
 {
-        struct lu_env          *env = cg->cg_env;
-        struct cl_lock         *lock = cg->cg_lock;
-        int                     refcheck;
+        struct lu_env  *env  = cg->cg_env;
+        struct cl_io   *io   = cg->cg_io;
+        struct cl_lock *lock = cg->cg_lock;
+        int             refcheck;
 
         LASSERT(cg->cg_env);
         LASSERT(cg->cg_gid);
@@ -186,7 +190,7 @@ void cl_put_grouplock(struct ccc_grouplock *cg)
 
         cl_unuse(env, lock);
         cl_lock_release(env, lock, GROUPLOCK_SCOPE, cfs_current());
-        cl_io_fini(env, &ccc_env_info(env)->cti_io);
+        cl_io_fini(env, io);
         cl_env_put(env, NULL);
 }