mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
ocfs2: move dlm work to a private work queue
The work that is done can block for long periods of time and so is not appropriate for keventd. Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
This commit is contained in:
parent
495ac96e63
commit
3156d26701
4 changed files with 32 additions and 3 deletions
|
@ -131,6 +131,7 @@ struct dlm_ctxt
|
|||
struct o2hb_callback_func dlm_hb_down;
|
||||
struct task_struct *dlm_thread_task;
|
||||
struct task_struct *dlm_reco_thread_task;
|
||||
struct workqueue_struct *dlm_worker;
|
||||
wait_queue_head_t dlm_thread_wq;
|
||||
wait_queue_head_t dlm_reco_thread_wq;
|
||||
wait_queue_head_t ast_wq;
|
||||
|
|
|
@ -303,11 +303,21 @@ int dlm_domain_fully_joined(struct dlm_ctxt *dlm)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void dlm_destroy_dlm_worker(struct dlm_ctxt *dlm)
|
||||
{
|
||||
if (dlm->dlm_worker) {
|
||||
flush_workqueue(dlm->dlm_worker);
|
||||
destroy_workqueue(dlm->dlm_worker);
|
||||
dlm->dlm_worker = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm)
|
||||
{
|
||||
dlm_unregister_domain_handlers(dlm);
|
||||
dlm_complete_thread(dlm);
|
||||
dlm_complete_recovery_thread(dlm);
|
||||
dlm_destroy_dlm_worker(dlm);
|
||||
|
||||
/* We've left the domain. Now we can take ourselves out of the
|
||||
* list and allow the kref stuff to help us free the
|
||||
|
@ -1151,6 +1161,13 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)
|
|||
goto bail;
|
||||
}
|
||||
|
||||
dlm->dlm_worker = create_singlethread_workqueue("dlm_wq");
|
||||
if (!dlm->dlm_worker) {
|
||||
status = -ENOMEM;
|
||||
mlog_errno(status);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
do {
|
||||
unsigned int backoff;
|
||||
status = dlm_try_to_join_domain(dlm);
|
||||
|
@ -1191,6 +1208,7 @@ bail:
|
|||
dlm_unregister_domain_handlers(dlm);
|
||||
dlm_complete_thread(dlm);
|
||||
dlm_complete_recovery_thread(dlm);
|
||||
dlm_destroy_dlm_worker(dlm);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1256,6 +1274,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
|
|||
|
||||
dlm->dlm_thread_task = NULL;
|
||||
dlm->dlm_reco_thread_task = NULL;
|
||||
dlm->dlm_worker = NULL;
|
||||
init_waitqueue_head(&dlm->dlm_thread_wq);
|
||||
init_waitqueue_head(&dlm->dlm_reco_thread_wq);
|
||||
init_waitqueue_head(&dlm->reco.event);
|
||||
|
|
|
@ -1962,7 +1962,7 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
|
|||
list_add_tail(&item->list, &dlm->work_list);
|
||||
spin_unlock(&dlm->work_lock);
|
||||
|
||||
schedule_work(&dlm->dispatched_work);
|
||||
queue_work(dlm->dlm_worker, &dlm->dispatched_work);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,11 +157,20 @@ void dlm_dispatch_work(void *data)
|
|||
struct list_head *iter, *iter2;
|
||||
struct dlm_work_item *item;
|
||||
dlm_workfunc_t *workfunc;
|
||||
int tot=0;
|
||||
|
||||
if (!dlm_joined(dlm))
|
||||
return;
|
||||
|
||||
spin_lock(&dlm->work_lock);
|
||||
list_splice_init(&dlm->work_list, &tmp_list);
|
||||
spin_unlock(&dlm->work_lock);
|
||||
|
||||
list_for_each_safe(iter, iter2, &tmp_list) {
|
||||
tot++;
|
||||
}
|
||||
mlog(0, "%s: work thread has %d work items\n", dlm->name, tot);
|
||||
|
||||
list_for_each_safe(iter, iter2, &tmp_list) {
|
||||
item = list_entry(iter, struct dlm_work_item, list);
|
||||
workfunc = item->func;
|
||||
|
@ -851,7 +860,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data)
|
|||
spin_lock(&dlm->work_lock);
|
||||
list_add_tail(&item->list, &dlm->work_list);
|
||||
spin_unlock(&dlm->work_lock);
|
||||
schedule_work(&dlm->dispatched_work);
|
||||
queue_work(dlm->dlm_worker, &dlm->dispatched_work);
|
||||
|
||||
dlm_put(dlm);
|
||||
return 0;
|
||||
|
@ -1401,7 +1410,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data)
|
|||
spin_lock(&dlm->work_lock);
|
||||
list_add_tail(&item->list, &dlm->work_list);
|
||||
spin_unlock(&dlm->work_lock);
|
||||
schedule_work(&dlm->dispatched_work);
|
||||
queue_work(dlm->dlm_worker, &dlm->dispatched_work);
|
||||
|
||||
leave:
|
||||
dlm_put(dlm);
|
||||
|
|
Loading…
Reference in a new issue