summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinshan Xiong <jinshan.xiong@intel.com>2016-11-10 12:30:54 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-14 16:02:55 +0100
commitd7f651ad64c2bbf2df47c3cacfbdae95740253eb (patch)
tree87afbeadbb0f74d95a9a918a2a8b7e96d84ecf74
parenta80ba5fe758131e456343160dcf12f3af7481d35 (diff)
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: Jinshan Xiong <jinshan.xiong@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7164 Reviewed-on: http://review.whamcloud.com/16433 Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Patrick Farrell <paf@cray.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 560bcaf8087e..786e55024724 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -360,6 +360,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);
@@ -398,6 +399,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);
}
}