Whamcloud - gitweb
LU-911 ost: ost_handle() to refill environment on every requests
authorMikhail Pershin <tappro@whamcloud.com>
Thu, 12 Apr 2012 10:09:20 +0000 (14:09 +0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Apr 2012 01:59:08 +0000 (21:59 -0400)
OST threads hold environment (lu_env) for request handling. when
a last instance of some device (say ofd or osd) gone, all keys
registered by the device are released, but enviroments are kept.
then at device instantiation the environments aren't repopulated.
this patch fixes this.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: Ib691f22955d40335535fcf3013d62badb24f7f49
Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1850
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lu_object.c
lustre/ost/ost_handler.c

index dda8de3..3993c18 100644 (file)
@@ -1476,6 +1476,7 @@ static int keys_fill(struct lu_context *ctx)
 {
         int i;
 
+        LINVRNT(ctx->lc_value != NULL);
         for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
                 struct lu_context_key *key;
 
@@ -1599,12 +1600,12 @@ EXPORT_SYMBOL(lu_context_exit);
 
 /**
  * Allocate for context all missing keys that were registered after context
- * creation.
+ * creation. key_set_version is only changed in rare cases when modules
+ * are loaded and removed.
  */
 int lu_context_refill(struct lu_context *ctx)
 {
-        LINVRNT(ctx->lc_value != NULL);
-        return ctx->lc_version == key_set_version ? 0 : keys_fill(ctx);
+        return likely(ctx->lc_version == key_set_version) ? 0 : keys_fill(ctx);
 }
 EXPORT_SYMBOL(lu_context_refill);
 
index 1b7864d..197381b 100644 (file)
@@ -2059,6 +2059,12 @@ int ost_handle(struct ptlrpc_request *req)
         struct obd_device *obd = NULL;
         ENTRY;
 
+        /* OST module is kept between remounts, but the last reference
+         * to specific module (say, osd or ofd) kills all related keys
+         * from the environment. so we have to refill it until the root
+         * cause is fixed properly */
+        lu_env_refill(req->rq_svc_thread->t_env);
+
         LASSERT(current->journal_info == NULL);
 
         /* primordial rpcs don't affect server recovery */