diff options
author | David Teigland <teigland@redhat.com> | 2006-11-27 12:31:22 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-30 10:37:00 -0500 |
commit | 2896ee37ccc1f9acb244c9b02becb74a43661009 (patch) | |
tree | c7129fd39b33c9c61516419b595f109bff500749 | |
parent | dcf3dd852f554bb0016aa23892596717cc123a26 (diff) |
[DLM] fix add_requestqueue checking nodes list
Requests that arrive after recovery has started are saved in the
requestqueue and processed after recovery is done. Some of these requests
are purged during recovery if they are from nodes that have been removed.
We move the purging of the requests (dlm_purge_requestqueue) to later in
the recovery sequence which allows the routine saving requests
(dlm_add_requestqueue) to avoid filtering out requests by nodeid since the
same will be done by the purge. The current code has add_requestqueue
filtering by nodeid but doesn't hold any locks when accessing the list of
current nodes. This also means that we need to call the purge routine
when the lockspace is being shut down since the add routine will not be
rejecting requests itself any more.
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/dlm/lockspace.c | 2 | ||||
-rw-r--r-- | fs/dlm/recoverd.c | 16 | ||||
-rw-r--r-- | fs/dlm/requestqueue.c | 7 |
3 files changed, 14 insertions, 11 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index f8842ca443c..791388b25c3 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "memory.h" | 22 | #include "memory.h" |
23 | #include "lock.h" | 23 | #include "lock.h" |
24 | #include "recover.h" | 24 | #include "recover.h" |
25 | #include "requestqueue.h" | ||
25 | 26 | ||
26 | #ifdef CONFIG_DLM_DEBUG | 27 | #ifdef CONFIG_DLM_DEBUG |
27 | int dlm_create_debug_file(struct dlm_ls *ls); | 28 | int dlm_create_debug_file(struct dlm_ls *ls); |
@@ -684,6 +685,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
684 | * Free structures on any other lists | 685 | * Free structures on any other lists |
685 | */ | 686 | */ |
686 | 687 | ||
688 | dlm_purge_requestqueue(ls); | ||
687 | kfree(ls->ls_recover_args); | 689 | kfree(ls->ls_recover_args); |
688 | dlm_clear_free_entries(ls); | 690 | dlm_clear_free_entries(ls); |
689 | dlm_clear_members(ls); | 691 | dlm_clear_members(ls); |
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c index 8bb895ffd90..9dc2f9156f1 100644 --- a/fs/dlm/recoverd.c +++ b/fs/dlm/recoverd.c | |||
@@ -94,14 +94,6 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Purge directory-related requests that are saved in requestqueue. | ||
98 | * All dir requests from before recovery are invalid now due to the dir | ||
99 | * rebuild and will be resent by the requesting nodes. | ||
100 | */ | ||
101 | |||
102 | dlm_purge_requestqueue(ls); | ||
103 | |||
104 | /* | ||
105 | * Wait for all nodes to complete directory rebuild. | 97 | * Wait for all nodes to complete directory rebuild. |
106 | */ | 98 | */ |
107 | 99 | ||
@@ -181,6 +173,14 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv) | |||
181 | 173 | ||
182 | dlm_release_root_list(ls); | 174 | dlm_release_root_list(ls); |
183 | 175 | ||
176 | /* | ||
177 | * Purge directory-related requests that are saved in requestqueue. | ||
178 | * All dir requests from before recovery are invalid now due to the dir | ||
179 | * rebuild and will be resent by the requesting nodes. | ||
180 | */ | ||
181 | |||
182 | dlm_purge_requestqueue(ls); | ||
183 | |||
184 | dlm_set_recover_status(ls, DLM_RS_DONE); | 184 | dlm_set_recover_status(ls, DLM_RS_DONE); |
185 | error = dlm_recover_done_wait(ls); | 185 | error = dlm_recover_done_wait(ls); |
186 | if (error) { | 186 | if (error) { |
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c index 0226d2a0a0f..65008d79c96 100644 --- a/fs/dlm/requestqueue.c +++ b/fs/dlm/requestqueue.c | |||
@@ -36,9 +36,6 @@ int dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd) | |||
36 | int length = hd->h_length; | 36 | int length = hd->h_length; |
37 | int rv = 0; | 37 | int rv = 0; |
38 | 38 | ||
39 | if (dlm_is_removed(ls, nodeid)) | ||
40 | return 0; | ||
41 | |||
42 | e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL); | 39 | e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL); |
43 | if (!e) { | 40 | if (!e) { |
44 | log_print("dlm_add_requestqueue: out of memory\n"); | 41 | log_print("dlm_add_requestqueue: out of memory\n"); |
@@ -133,6 +130,10 @@ static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid) | |||
133 | { | 130 | { |
134 | uint32_t type = ms->m_type; | 131 | uint32_t type = ms->m_type; |
135 | 132 | ||
133 | /* the ls is being cleaned up and freed by release_lockspace */ | ||
134 | if (!ls->ls_count) | ||
135 | return 1; | ||
136 | |||
136 | if (dlm_is_removed(ls, nodeid)) | 137 | if (dlm_is_removed(ls, nodeid)) |
137 | return 1; | 138 | return 1; |
138 | 139 | ||