From f790db61313e85fdece589118a0798a4607dbcb0 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Tue, 15 Sep 2015 12:19:10 -0700 Subject: [PATCH] LU-7164 osc: osc_extent should hold refcount to osc_object To avoid a race that osc_extent and osc_object destroy happens on the same time, which causes kernel crash. Signed-off-by: Jinshan Xiong Change-Id: I3e3237f0d1cff4bd992bef4e4c01355a1d5c8d9f Reviewed-on: http://review.whamcloud.com/16433 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/osc/osc_cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 981f35c..0d616bf 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -325,6 +325,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) RB_CLEAR_NODE(&ext->oe_node); ext->oe_obj = obj; + cl_object_get(osc2cl(obj)); atomic_set(&ext->oe_refc, 1); atomic_set(&ext->oe_users, 0); INIT_LIST_HEAD(&ext->oe_link); @@ -363,6 +364,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) LDLM_LOCK_PUT(ext->oe_dlmlock); ext->oe_dlmlock = NULL; } + cl_object_put(env, osc2cl(ext->oe_obj)); osc_extent_free(ext); } } -- 1.8.3.1