From 8e817d26e1027a2feea0f9618fc667e7c34a3bdb Mon Sep 17 00:00:00 2001 From: fanyong Date: Wed, 11 Oct 2006 08:48:12 +0000 Subject: [PATCH] Drop security ctxt when umount, for avoiding ldlm_revoke_export_locks accessing freed resource. --- lustre/include/lustre_sec.h | 1 + lustre/ptlrpc/import.c | 1 + lustre/ptlrpc/sec.c | 9 +++++++++ lustre/ptlrpc/service.c | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 2065e2f..e316eae 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -458,6 +458,7 @@ void sptlrpc_import_put_sec(struct obd_import *imp); int sptlrpc_import_check_ctx(struct obd_import *imp); void sptlrpc_import_flush_root_ctx(struct obd_import *imp); void sptlrpc_import_flush_my_ctx(struct obd_import *imp); +void sptlrpc_import_flush_all_ctx(struct obd_import *imp); int sptlrpc_req_get_ctx(struct ptlrpc_request *req); void sptlrpc_req_put_ctx(struct ptlrpc_request *req); int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 46bb13c..9c323b1 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -203,6 +203,7 @@ void ptlrpc_invalidate_import(struct obd_import *imp) atomic_read(&imp->imp_inflight)); obd_import_event(imp->imp_obd, imp, IMP_EVENT_INVALIDATE); + sptlrpc_import_flush_all_ctx(imp); } /* unset imp_invalid */ diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 00dcec6..b2b1a34 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -1408,6 +1408,15 @@ void sptlrpc_import_flush_my_ctx(struct obd_import *imp) } EXPORT_SYMBOL(sptlrpc_import_flush_my_ctx); +void sptlrpc_import_flush_all_ctx(struct obd_import *imp) +{ + if (imp == NULL || imp->imp_sec == NULL) + return; + + ctx_cache_flush(imp->imp_sec, -1, 0, 1); +} +EXPORT_SYMBOL(sptlrpc_import_flush_all_ctx); + int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp, struct ptlrpc_cli_ctx *ctx) { diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index d21a54c..77198b6 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -583,6 +583,10 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, svc->srv_n_active_reqs); } + /* go through security check/transform */ + request->rq_auth_uid = INVALID_UID; + request->rq_auth_mapped_uid = INVALID_UID; + rc = sptlrpc_svc_unwrap_request(request); switch (rc) { case SECSVC_OK: -- 1.8.3.1