50#include "dlmcommon.h"
51#include "dlmdomain.h"
52
53#define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_THREAD)
54#include "cluster/masklog.h"
55
56static int dlm_thread(void *data);
57static void dlm_flush_asts(struct dlm_ctxt *dlm);
58
59#define dlm_lock_is_remote(dlm, lock) ((lock)->ml.node != (dlm)->node_num)
60
61
62
63void __dlm_wait_on_lockres_flags(struct dlm_lock_resource *res, int flags)
64{
65 DECLARE_WAITQUEUE(wait, current);
66
67 assert_spin_locked(&res->spinlock);
68
69 add_wait_queue(&res->wq, &wait);
70repeat:
71 set_current_state(TASK_UNINTERRUPTIBLE);
72 if (res->state & flags) {
73 spin_unlock(&res->spinlock);
74 schedule();
75 spin_lock(&res->spinlock);
76 goto repeat;
77 }
78 remove_wait_queue(&res->wq, &wait);
79 __set_current_state(TASK_RUNNING);
80}
81
82int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
83{
84 if (list_empty(&res->granted) &&
85 list_empty(&res->converting) &&
86 list_empty(&res->blocked))
87 return 0;
88 return 1;
89}
90