Whamcloud - gitweb
LU-3328 osp: Only signal thread completion when we are done
authorOleg Drokin <green@whamcloud.com>
Mon, 13 May 2013 17:11:23 +0000 (13:11 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 15 May 2013 17:19:08 +0000 (13:19 -0400)
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 <green@intel.com>
Reviewed-on: http://review.whamcloud.com/6329
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/osp/osp_sync.c

index fa90527..d6ebdb9 100644 (file)
@@ -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);