From 3623caa0b61efbc3919b1d25ac0052a586f7145b Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 13 May 2013 13:11:23 -0400 Subject: [PATCH] LU-3328 osp: Only signal thread completion when we are done IT seems that by signalling the completion of a thread before we are done inspecting it's memory is racy and could cause access to freed memory. Change-Id: Ia992e9c7d0d78fca1afbfc98f51c5df3f6dc3a28 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/6329 Tested-by: Hudson Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Tested-by: Maloo --- lustre/osp/osp_sync.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index fa90527..d6ebdb9 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -890,15 +890,16 @@ static int osp_sync_thread(void *_arg) if (rc) CERROR("can't cleanup llog: %d\n", rc); out: - thread->t_flags = SVC_STOPPED; - - cfs_waitq_signal(&thread->t_ctl_waitq); LASSERTF(d->opd_syn_rpc_in_progress == 0, "%s: %d %d %sempty\n", d->opd_obd->obd_name, d->opd_syn_rpc_in_progress, d->opd_syn_rpc_in_flight, cfs_list_empty(&d->opd_syn_committed_there) ? "" : "!"); + thread->t_flags = SVC_STOPPED; + + cfs_waitq_signal(&thread->t_ctl_waitq); + lu_env_fini(&env); RETURN(0); -- 1.8.3.1