Commit d7f651ad authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman

staging: lustre: 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: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7164
Reviewed-on: http://review.whamcloud.com/16433Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarPatrick Farrell <paf@cray.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a80ba5fe
...@@ -360,6 +360,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) ...@@ -360,6 +360,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj)
RB_CLEAR_NODE(&ext->oe_node); RB_CLEAR_NODE(&ext->oe_node);
ext->oe_obj = obj; ext->oe_obj = obj;
cl_object_get(osc2cl(obj));
atomic_set(&ext->oe_refc, 1); atomic_set(&ext->oe_refc, 1);
atomic_set(&ext->oe_users, 0); atomic_set(&ext->oe_users, 0);
INIT_LIST_HEAD(&ext->oe_link); INIT_LIST_HEAD(&ext->oe_link);
...@@ -398,6 +399,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) ...@@ -398,6 +399,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext)
LDLM_LOCK_PUT(ext->oe_dlmlock); LDLM_LOCK_PUT(ext->oe_dlmlock);
ext->oe_dlmlock = NULL; ext->oe_dlmlock = NULL;
} }
cl_object_put(env, osc2cl(ext->oe_obj));
osc_extent_free(ext); osc_extent_free(ext);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment