From: Oleg Drokin Date: Mon, 13 May 2013 17:11:23 +0000 (-0400) Subject: LU-3328 osp: Only signal thread completion when we are done X-Git-Tag: 2.4.0-RC1~4 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=3623caa0b61efbc3919b1d25ac0052a586f7145b;p=fs%2Flustre-release.git 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 --- 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);