diff options
Diffstat (limited to 'fs/dlm/member.c')
-rw-r--r-- | fs/dlm/member.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/fs/dlm/member.c b/fs/dlm/member.c index fa17f5a27883..26133f05ae3a 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c | |||
@@ -210,6 +210,23 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out) | |||
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | /* Add an entry to ls_nodes_gone for members that were removed and | ||
214 | then added again, so that previous state for these nodes will be | ||
215 | cleared during recovery. */ | ||
216 | |||
217 | for (i = 0; i < rv->new_count; i++) { | ||
218 | if (!dlm_is_member(ls, rv->new[i])) | ||
219 | continue; | ||
220 | log_debug(ls, "new nodeid %d is a re-added member", rv->new[i]); | ||
221 | |||
222 | memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL); | ||
223 | if (!memb) | ||
224 | return -ENOMEM; | ||
225 | memb->nodeid = rv->new[i]; | ||
226 | list_add_tail(&memb->list, &ls->ls_nodes_gone); | ||
227 | neg++; | ||
228 | } | ||
229 | |||
213 | /* add new members to ls_nodes */ | 230 | /* add new members to ls_nodes */ |
214 | 231 | ||
215 | for (i = 0; i < rv->node_count; i++) { | 232 | for (i = 0; i < rv->node_count; i++) { |
@@ -314,15 +331,16 @@ int dlm_ls_stop(struct dlm_ls *ls) | |||
314 | int dlm_ls_start(struct dlm_ls *ls) | 331 | int dlm_ls_start(struct dlm_ls *ls) |
315 | { | 332 | { |
316 | struct dlm_recover *rv = NULL, *rv_old; | 333 | struct dlm_recover *rv = NULL, *rv_old; |
317 | int *ids = NULL; | 334 | int *ids = NULL, *new = NULL; |
318 | int error, count; | 335 | int error, ids_count = 0, new_count = 0; |
319 | 336 | ||
320 | rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL); | 337 | rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL); |
321 | if (!rv) | 338 | if (!rv) |
322 | return -ENOMEM; | 339 | return -ENOMEM; |
323 | 340 | ||
324 | error = count = dlm_nodeid_list(ls->ls_name, &ids); | 341 | error = dlm_nodeid_list(ls->ls_name, &ids, &ids_count, |
325 | if (error <= 0) | 342 | &new, &new_count); |
343 | if (error < 0) | ||
326 | goto fail; | 344 | goto fail; |
327 | 345 | ||
328 | spin_lock(&ls->ls_recover_lock); | 346 | spin_lock(&ls->ls_recover_lock); |
@@ -337,14 +355,19 @@ int dlm_ls_start(struct dlm_ls *ls) | |||
337 | } | 355 | } |
338 | 356 | ||
339 | rv->nodeids = ids; | 357 | rv->nodeids = ids; |
340 | rv->node_count = count; | 358 | rv->node_count = ids_count; |
359 | rv->new = new; | ||
360 | rv->new_count = new_count; | ||
341 | rv->seq = ++ls->ls_recover_seq; | 361 | rv->seq = ++ls->ls_recover_seq; |
342 | rv_old = ls->ls_recover_args; | 362 | rv_old = ls->ls_recover_args; |
343 | ls->ls_recover_args = rv; | 363 | ls->ls_recover_args = rv; |
344 | spin_unlock(&ls->ls_recover_lock); | 364 | spin_unlock(&ls->ls_recover_lock); |
345 | 365 | ||
346 | if (rv_old) { | 366 | if (rv_old) { |
367 | log_error(ls, "unused recovery %llx %d", | ||
368 | (unsigned long long)rv_old->seq, rv_old->node_count); | ||
347 | kfree(rv_old->nodeids); | 369 | kfree(rv_old->nodeids); |
370 | kfree(rv_old->new); | ||
348 | kfree(rv_old); | 371 | kfree(rv_old); |
349 | } | 372 | } |
350 | 373 | ||
@@ -354,6 +377,7 @@ int dlm_ls_start(struct dlm_ls *ls) | |||
354 | fail: | 377 | fail: |
355 | kfree(rv); | 378 | kfree(rv); |
356 | kfree(ids); | 379 | kfree(ids); |
380 | kfree(new); | ||
357 | return error; | 381 | return error; |
358 | } | 382 | } |
359 | 383 | ||