aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/recovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/recovery.c')
-rw-r--r--fs/gfs2/recovery.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index e91c2bda6c32..7d467966f92c 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -436,30 +436,35 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
436 unsigned int pass; 436 unsigned int pass;
437 int error; 437 int error;
438 438
439 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", jd->jd_jid); 439 if (jd->jd_jid != sdp->sd_lockstruct.ls_jid) {
440 440 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n",
441 /* Aquire the journal lock so we can do recovery */ 441 jd->jd_jid);
442
443 error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
444 LM_ST_EXCLUSIVE,
445 LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
446 &j_gh);
447 switch (error) {
448 case 0:
449 break;
450 442
451 case GLR_TRYFAILED: 443 /* Aquire the journal lock so we can do recovery */
452 fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid);
453 error = 0;
454 444
455 default: 445 error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
456 goto fail; 446 LM_ST_EXCLUSIVE,
457 }; 447 LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
448 &j_gh);
449 switch (error) {
450 case 0:
451 break;
452
453 case GLR_TRYFAILED:
454 fs_info(sdp, "jid=%u: Busy\n", jd->jd_jid);
455 error = 0;
456
457 default:
458 goto fail;
459 };
458 460
459 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 461 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
460 LM_FLAG_NOEXP, &ji_gh); 462 LM_FLAG_NOEXP, &ji_gh);
461 if (error) 463 if (error)
462 goto fail_gunlock_j; 464 goto fail_gunlock_j;
465 } else {
466 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid);
467 }
463 468
464 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid); 469 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid);
465 470
@@ -481,10 +486,8 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
481 486
482 error = gfs2_glock_nq_init(sdp->sd_trans_gl, 487 error = gfs2_glock_nq_init(sdp->sd_trans_gl,
483 LM_ST_SHARED, 488 LM_ST_SHARED,
484 LM_FLAG_NOEXP | 489 LM_FLAG_NOEXP | LM_FLAG_PRIORITY |
485 LM_FLAG_PRIORITY | 490 GL_NEVER_RECURSE | GL_NOCANCEL |
486 GL_NEVER_RECURSE |
487 GL_NOCANCEL |
488 GL_NOCACHE, 491 GL_NOCACHE,
489 &t_gh); 492 &t_gh);
490 if (error) 493 if (error)
@@ -521,37 +524,35 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
521 goto fail_gunlock_tr; 524 goto fail_gunlock_tr;
522 525
523 gfs2_glock_dq_uninit(&t_gh); 526 gfs2_glock_dq_uninit(&t_gh);
524
525 t = DIV_ROUND_UP(jiffies - t, HZ); 527 t = DIV_ROUND_UP(jiffies - t, HZ);
526
527 fs_info(sdp, "jid=%u: Journal replayed in %lus\n", 528 fs_info(sdp, "jid=%u: Journal replayed in %lus\n",
528 jd->jd_jid, t); 529 jd->jd_jid, t);
529 } 530 }
530 531
531 gfs2_glock_dq_uninit(&ji_gh); 532 if (jd->jd_jid != sdp->sd_lockstruct.ls_jid)
533 gfs2_glock_dq_uninit(&ji_gh);
532 534
533 gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS); 535 gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS);
534 536
535 gfs2_glock_dq_uninit(&j_gh); 537 if (jd->jd_jid != sdp->sd_lockstruct.ls_jid)
538 gfs2_glock_dq_uninit(&j_gh);
536 539
537 fs_info(sdp, "jid=%u: Done\n", jd->jd_jid); 540 fs_info(sdp, "jid=%u: Done\n", jd->jd_jid);
538
539 return 0; 541 return 0;
540 542
541 fail_gunlock_tr: 543fail_gunlock_tr:
542 gfs2_glock_dq_uninit(&t_gh); 544 gfs2_glock_dq_uninit(&t_gh);
543 545fail_gunlock_ji:
544 fail_gunlock_ji: 546 if (jd->jd_jid != sdp->sd_lockstruct.ls_jid) {
545 gfs2_glock_dq_uninit(&ji_gh); 547 gfs2_glock_dq_uninit(&ji_gh);
546 548fail_gunlock_j:
547 fail_gunlock_j: 549 gfs2_glock_dq_uninit(&j_gh);
548 gfs2_glock_dq_uninit(&j_gh); 550 }
549 551
550 fs_info(sdp, "jid=%u: %s\n", jd->jd_jid, (error) ? "Failed" : "Done"); 552 fs_info(sdp, "jid=%u: %s\n", jd->jd_jid, (error) ? "Failed" : "Done");
551 553
552 fail: 554fail:
553 gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); 555 gfs2_lm_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP);
554
555 return error; 556 return error;
556} 557}
557 558