| .. | .. |
|---|
| 732 | 732 | |
|---|
| 733 | 733 | static void recover_lvb(struct dlm_rsb *r) |
|---|
| 734 | 734 | { |
|---|
| 735 | | - struct dlm_lkb *lkb, *high_lkb = NULL; |
|---|
| 735 | + struct dlm_lkb *big_lkb = NULL, *iter, *high_lkb = NULL; |
|---|
| 736 | 736 | uint32_t high_seq = 0; |
|---|
| 737 | 737 | int lock_lvb_exists = 0; |
|---|
| 738 | | - int big_lock_exists = 0; |
|---|
| 739 | 738 | int lvblen = r->res_ls->ls_lvblen; |
|---|
| 740 | 739 | |
|---|
| 741 | 740 | if (!rsb_flag(r, RSB_NEW_MASTER2) && |
|---|
| .. | .. |
|---|
| 751 | 750 | /* we are the new master, so figure out if VALNOTVALID should |
|---|
| 752 | 751 | be set, and set the rsb lvb from the best lkb available. */ |
|---|
| 753 | 752 | |
|---|
| 754 | | - list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { |
|---|
| 755 | | - if (!(lkb->lkb_exflags & DLM_LKF_VALBLK)) |
|---|
| 753 | + list_for_each_entry(iter, &r->res_grantqueue, lkb_statequeue) { |
|---|
| 754 | + if (!(iter->lkb_exflags & DLM_LKF_VALBLK)) |
|---|
| 756 | 755 | continue; |
|---|
| 757 | 756 | |
|---|
| 758 | 757 | lock_lvb_exists = 1; |
|---|
| 759 | 758 | |
|---|
| 760 | | - if (lkb->lkb_grmode > DLM_LOCK_CR) { |
|---|
| 761 | | - big_lock_exists = 1; |
|---|
| 759 | + if (iter->lkb_grmode > DLM_LOCK_CR) { |
|---|
| 760 | + big_lkb = iter; |
|---|
| 762 | 761 | goto setflag; |
|---|
| 763 | 762 | } |
|---|
| 764 | 763 | |
|---|
| 765 | | - if (((int)lkb->lkb_lvbseq - (int)high_seq) >= 0) { |
|---|
| 766 | | - high_lkb = lkb; |
|---|
| 767 | | - high_seq = lkb->lkb_lvbseq; |
|---|
| 764 | + if (((int)iter->lkb_lvbseq - (int)high_seq) >= 0) { |
|---|
| 765 | + high_lkb = iter; |
|---|
| 766 | + high_seq = iter->lkb_lvbseq; |
|---|
| 768 | 767 | } |
|---|
| 769 | 768 | } |
|---|
| 770 | 769 | |
|---|
| 771 | | - list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { |
|---|
| 772 | | - if (!(lkb->lkb_exflags & DLM_LKF_VALBLK)) |
|---|
| 770 | + list_for_each_entry(iter, &r->res_convertqueue, lkb_statequeue) { |
|---|
| 771 | + if (!(iter->lkb_exflags & DLM_LKF_VALBLK)) |
|---|
| 773 | 772 | continue; |
|---|
| 774 | 773 | |
|---|
| 775 | 774 | lock_lvb_exists = 1; |
|---|
| 776 | 775 | |
|---|
| 777 | | - if (lkb->lkb_grmode > DLM_LOCK_CR) { |
|---|
| 778 | | - big_lock_exists = 1; |
|---|
| 776 | + if (iter->lkb_grmode > DLM_LOCK_CR) { |
|---|
| 777 | + big_lkb = iter; |
|---|
| 779 | 778 | goto setflag; |
|---|
| 780 | 779 | } |
|---|
| 781 | 780 | |
|---|
| 782 | | - if (((int)lkb->lkb_lvbseq - (int)high_seq) >= 0) { |
|---|
| 783 | | - high_lkb = lkb; |
|---|
| 784 | | - high_seq = lkb->lkb_lvbseq; |
|---|
| 781 | + if (((int)iter->lkb_lvbseq - (int)high_seq) >= 0) { |
|---|
| 782 | + high_lkb = iter; |
|---|
| 783 | + high_seq = iter->lkb_lvbseq; |
|---|
| 785 | 784 | } |
|---|
| 786 | 785 | } |
|---|
| 787 | 786 | |
|---|
| .. | .. |
|---|
| 790 | 789 | goto out; |
|---|
| 791 | 790 | |
|---|
| 792 | 791 | /* lvb is invalidated if only NL/CR locks remain */ |
|---|
| 793 | | - if (!big_lock_exists) |
|---|
| 792 | + if (!big_lkb) |
|---|
| 794 | 793 | rsb_set_flag(r, RSB_VALNOTVALID); |
|---|
| 795 | 794 | |
|---|
| 796 | 795 | if (!r->res_lvbptr) { |
|---|
| .. | .. |
|---|
| 799 | 798 | goto out; |
|---|
| 800 | 799 | } |
|---|
| 801 | 800 | |
|---|
| 802 | | - if (big_lock_exists) { |
|---|
| 803 | | - r->res_lvbseq = lkb->lkb_lvbseq; |
|---|
| 804 | | - memcpy(r->res_lvbptr, lkb->lkb_lvbptr, lvblen); |
|---|
| 801 | + if (big_lkb) { |
|---|
| 802 | + r->res_lvbseq = big_lkb->lkb_lvbseq; |
|---|
| 803 | + memcpy(r->res_lvbptr, big_lkb->lkb_lvbptr, lvblen); |
|---|
| 805 | 804 | } else if (high_lkb) { |
|---|
| 806 | 805 | r->res_lvbseq = high_lkb->lkb_lvbseq; |
|---|
| 807 | 806 | memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen); |
|---|