hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/dlm/recover.c
....@@ -732,10 +732,9 @@
732732
733733 static void recover_lvb(struct dlm_rsb *r)
734734 {
735
- struct dlm_lkb *lkb, *high_lkb = NULL;
735
+ struct dlm_lkb *big_lkb = NULL, *iter, *high_lkb = NULL;
736736 uint32_t high_seq = 0;
737737 int lock_lvb_exists = 0;
738
- int big_lock_exists = 0;
739738 int lvblen = r->res_ls->ls_lvblen;
740739
741740 if (!rsb_flag(r, RSB_NEW_MASTER2) &&
....@@ -751,37 +750,37 @@
751750 /* we are the new master, so figure out if VALNOTVALID should
752751 be set, and set the rsb lvb from the best lkb available. */
753752
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))
756755 continue;
757756
758757 lock_lvb_exists = 1;
759758
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;
762761 goto setflag;
763762 }
764763
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;
768767 }
769768 }
770769
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))
773772 continue;
774773
775774 lock_lvb_exists = 1;
776775
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;
779778 goto setflag;
780779 }
781780
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;
785784 }
786785 }
787786
....@@ -790,7 +789,7 @@
790789 goto out;
791790
792791 /* lvb is invalidated if only NL/CR locks remain */
793
- if (!big_lock_exists)
792
+ if (!big_lkb)
794793 rsb_set_flag(r, RSB_VALNOTVALID);
795794
796795 if (!r->res_lvbptr) {
....@@ -799,9 +798,9 @@
799798 goto out;
800799 }
801800
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);
805804 } else if (high_lkb) {
806805 r->res_lvbseq = high_lkb->lkb_lvbseq;
807806 memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen);