hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/dlm/recover.c
....@@ -1,12 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 *******************************************************************************
34 **
45 ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
56 ** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
67 **
7
-** This copyrighted material is made available to anyone wishing to use,
8
-** modify, copy, or redistribute it subject to the terms and conditions
9
-** of the GNU General Public License v.2.
108 **
119 *******************************************************************************
1210 ******************************************************************************/
....@@ -734,10 +732,9 @@
734732
735733 static void recover_lvb(struct dlm_rsb *r)
736734 {
737
- struct dlm_lkb *lkb, *high_lkb = NULL;
735
+ struct dlm_lkb *big_lkb = NULL, *iter, *high_lkb = NULL;
738736 uint32_t high_seq = 0;
739737 int lock_lvb_exists = 0;
740
- int big_lock_exists = 0;
741738 int lvblen = r->res_ls->ls_lvblen;
742739
743740 if (!rsb_flag(r, RSB_NEW_MASTER2) &&
....@@ -753,37 +750,37 @@
753750 /* we are the new master, so figure out if VALNOTVALID should
754751 be set, and set the rsb lvb from the best lkb available. */
755752
756
- list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
757
- 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))
758755 continue;
759756
760757 lock_lvb_exists = 1;
761758
762
- if (lkb->lkb_grmode > DLM_LOCK_CR) {
763
- big_lock_exists = 1;
759
+ if (iter->lkb_grmode > DLM_LOCK_CR) {
760
+ big_lkb = iter;
764761 goto setflag;
765762 }
766763
767
- if (((int)lkb->lkb_lvbseq - (int)high_seq) >= 0) {
768
- high_lkb = lkb;
769
- 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;
770767 }
771768 }
772769
773
- list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) {
774
- 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))
775772 continue;
776773
777774 lock_lvb_exists = 1;
778775
779
- if (lkb->lkb_grmode > DLM_LOCK_CR) {
780
- big_lock_exists = 1;
776
+ if (iter->lkb_grmode > DLM_LOCK_CR) {
777
+ big_lkb = iter;
781778 goto setflag;
782779 }
783780
784
- if (((int)lkb->lkb_lvbseq - (int)high_seq) >= 0) {
785
- high_lkb = lkb;
786
- 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;
787784 }
788785 }
789786
....@@ -792,7 +789,7 @@
792789 goto out;
793790
794791 /* lvb is invalidated if only NL/CR locks remain */
795
- if (!big_lock_exists)
792
+ if (!big_lkb)
796793 rsb_set_flag(r, RSB_VALNOTVALID);
797794
798795 if (!r->res_lvbptr) {
....@@ -801,9 +798,9 @@
801798 goto out;
802799 }
803800
804
- if (big_lock_exists) {
805
- r->res_lvbseq = lkb->lkb_lvbseq;
806
- 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);
807804 } else if (high_lkb) {
808805 r->res_lvbseq = high_lkb->lkb_lvbseq;
809806 memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen);