aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/requestqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dlm/requestqueue.c')
-rw-r--r--fs/dlm/requestqueue.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
index a44fa22890e1..1695f1b0dd45 100644
--- a/fs/dlm/requestqueue.c
+++ b/fs/dlm/requestqueue.c
@@ -19,6 +19,7 @@
19 19
20struct rq_entry { 20struct rq_entry {
21 struct list_head list; 21 struct list_head list;
22 uint32_t recover_seq;
22 int nodeid; 23 int nodeid;
23 struct dlm_message request; 24 struct dlm_message request;
24}; 25};
@@ -41,6 +42,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
41 return; 42 return;
42 } 43 }
43 44
45 e->recover_seq = ls->ls_recover_seq & 0xFFFFFFFF;
44 e->nodeid = nodeid; 46 e->nodeid = nodeid;
45 memcpy(&e->request, ms, ms->m_header.h_length); 47 memcpy(&e->request, ms, ms->m_header.h_length);
46 48
@@ -63,6 +65,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
63int dlm_process_requestqueue(struct dlm_ls *ls) 65int dlm_process_requestqueue(struct dlm_ls *ls)
64{ 66{
65 struct rq_entry *e; 67 struct rq_entry *e;
68 struct dlm_message *ms;
66 int error = 0; 69 int error = 0;
67 70
68 mutex_lock(&ls->ls_requestqueue_mutex); 71 mutex_lock(&ls->ls_requestqueue_mutex);
@@ -76,7 +79,15 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
76 e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list); 79 e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list);
77 mutex_unlock(&ls->ls_requestqueue_mutex); 80 mutex_unlock(&ls->ls_requestqueue_mutex);
78 81
79 dlm_receive_message_saved(ls, &e->request); 82 ms = &e->request;
83
84 log_limit(ls, "dlm_process_requestqueue msg %d from %d "
85 "lkid %x remid %x result %d seq %u",
86 ms->m_type, ms->m_header.h_nodeid,
87 ms->m_lkid, ms->m_remid, ms->m_result,
88 e->recover_seq);
89
90 dlm_receive_message_saved(ls, &e->request, e->recover_seq);
80 91
81 mutex_lock(&ls->ls_requestqueue_mutex); 92 mutex_lock(&ls->ls_requestqueue_mutex);
82 list_del(&e->list); 93 list_del(&e->list);
@@ -138,35 +149,7 @@ static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
138 if (!dlm_no_directory(ls)) 149 if (!dlm_no_directory(ls))
139 return 0; 150 return 0;
140 151
141 /* with no directory, the master is likely to change as a part of 152 return 1;
142 recovery; requests to/from the defunct master need to be purged */
143
144 switch (type) {
145 case DLM_MSG_REQUEST:
146 case DLM_MSG_CONVERT:
147 case DLM_MSG_UNLOCK:
148 case DLM_MSG_CANCEL:
149 /* we're no longer the master of this resource, the sender
150 will resend to the new master (see waiter_needs_recovery) */
151
152 if (dlm_hash2nodeid(ls, ms->m_hash) != dlm_our_nodeid())
153 return 1;
154 break;
155
156 case DLM_MSG_REQUEST_REPLY:
157 case DLM_MSG_CONVERT_REPLY:
158 case DLM_MSG_UNLOCK_REPLY:
159 case DLM_MSG_CANCEL_REPLY:
160 case DLM_MSG_GRANT:
161 /* this reply is from the former master of the resource,
162 we'll resend to the new master if needed */
163
164 if (dlm_hash2nodeid(ls, ms->m_hash) != nodeid)
165 return 1;
166 break;
167 }
168
169 return 0;
170} 153}
171 154
172void dlm_purge_requestqueue(struct dlm_ls *ls) 155void dlm_purge_requestqueue(struct dlm_ls *ls)