From 8ca651d636c37339cc50bffa4532b7cbd0ead570 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Thu, 12 Apr 2012 14:09:20 +0400 Subject: [PATCH] LU-911 ost: ost_handle() to refill environment on every requests 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 Change-Id: Ib691f22955d40335535fcf3013d62badb24f7f49 Signed-off-by: Mikhail Pershin Reviewed-on: http://review.whamcloud.com/1850 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/lu_object.c | 7 ++++--- lustre/ost/ost_handler.c | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index dda8de3..3993c18 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -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); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 1b7864d..197381b 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -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 */ -- 1.8.3.1