aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmdomain.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 3511930a34ee..c3462ea694ea 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -303,11 +303,21 @@ int dlm_domain_fully_joined(struct dlm_ctxt *dlm)
303 return ret; 303 return ret;
304} 304}
305 305
306static void dlm_destroy_dlm_worker(struct dlm_ctxt *dlm)
307{
308 if (dlm->dlm_worker) {
309 flush_workqueue(dlm->dlm_worker);
310 destroy_workqueue(dlm->dlm_worker);
311 dlm->dlm_worker = NULL;
312 }
313}
314
306static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm) 315static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm)
307{ 316{
308 dlm_unregister_domain_handlers(dlm); 317 dlm_unregister_domain_handlers(dlm);
309 dlm_complete_thread(dlm); 318 dlm_complete_thread(dlm);
310 dlm_complete_recovery_thread(dlm); 319 dlm_complete_recovery_thread(dlm);
320 dlm_destroy_dlm_worker(dlm);
311 321
312 /* We've left the domain. Now we can take ourselves out of the 322 /* We've left the domain. Now we can take ourselves out of the
313 * list and allow the kref stuff to help us free the 323 * list and allow the kref stuff to help us free the
@@ -1151,6 +1161,13 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)
1151 goto bail; 1161 goto bail;
1152 } 1162 }
1153 1163
1164 dlm->dlm_worker = create_singlethread_workqueue("dlm_wq");
1165 if (!dlm->dlm_worker) {
1166 status = -ENOMEM;
1167 mlog_errno(status);
1168 goto bail;
1169 }
1170
1154 do { 1171 do {
1155 unsigned int backoff; 1172 unsigned int backoff;
1156 status = dlm_try_to_join_domain(dlm); 1173 status = dlm_try_to_join_domain(dlm);
@@ -1191,6 +1208,7 @@ bail:
1191 dlm_unregister_domain_handlers(dlm); 1208 dlm_unregister_domain_handlers(dlm);
1192 dlm_complete_thread(dlm); 1209 dlm_complete_thread(dlm);
1193 dlm_complete_recovery_thread(dlm); 1210 dlm_complete_recovery_thread(dlm);
1211 dlm_destroy_dlm_worker(dlm);
1194 } 1212 }
1195 1213
1196 return status; 1214 return status;
@@ -1256,6 +1274,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
1256 1274
1257 dlm->dlm_thread_task = NULL; 1275 dlm->dlm_thread_task = NULL;
1258 dlm->dlm_reco_thread_task = NULL; 1276 dlm->dlm_reco_thread_task = NULL;
1277 dlm->dlm_worker = NULL;
1259 init_waitqueue_head(&dlm->dlm_thread_wq); 1278 init_waitqueue_head(&dlm->dlm_thread_wq);
1260 init_waitqueue_head(&dlm->dlm_reco_thread_wq); 1279 init_waitqueue_head(&dlm->dlm_reco_thread_wq);
1261 init_waitqueue_head(&dlm->reco.event); 1280 init_waitqueue_head(&dlm->reco.event);