.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /****************************************************************************** |
---|
2 | 3 | ******************************************************************************* |
---|
3 | 4 | ** |
---|
4 | 5 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
---|
5 | 6 | ** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. |
---|
6 | 7 | ** |
---|
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. |
---|
10 | 8 | ** |
---|
11 | 9 | ******************************************************************************* |
---|
12 | 10 | ******************************************************************************/ |
---|
.. | .. |
---|
734 | 732 | |
---|
735 | 733 | static void recover_lvb(struct dlm_rsb *r) |
---|
736 | 734 | { |
---|
737 | | - struct dlm_lkb *lkb, *high_lkb = NULL; |
---|
| 735 | + struct dlm_lkb *big_lkb = NULL, *iter, *high_lkb = NULL; |
---|
738 | 736 | uint32_t high_seq = 0; |
---|
739 | 737 | int lock_lvb_exists = 0; |
---|
740 | | - int big_lock_exists = 0; |
---|
741 | 738 | int lvblen = r->res_ls->ls_lvblen; |
---|
742 | 739 | |
---|
743 | 740 | if (!rsb_flag(r, RSB_NEW_MASTER2) && |
---|
.. | .. |
---|
753 | 750 | /* we are the new master, so figure out if VALNOTVALID should |
---|
754 | 751 | be set, and set the rsb lvb from the best lkb available. */ |
---|
755 | 752 | |
---|
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)) |
---|
758 | 755 | continue; |
---|
759 | 756 | |
---|
760 | 757 | lock_lvb_exists = 1; |
---|
761 | 758 | |
---|
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; |
---|
764 | 761 | goto setflag; |
---|
765 | 762 | } |
---|
766 | 763 | |
---|
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; |
---|
770 | 767 | } |
---|
771 | 768 | } |
---|
772 | 769 | |
---|
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)) |
---|
775 | 772 | continue; |
---|
776 | 773 | |
---|
777 | 774 | lock_lvb_exists = 1; |
---|
778 | 775 | |
---|
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; |
---|
781 | 778 | goto setflag; |
---|
782 | 779 | } |
---|
783 | 780 | |
---|
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; |
---|
787 | 784 | } |
---|
788 | 785 | } |
---|
789 | 786 | |
---|
.. | .. |
---|
792 | 789 | goto out; |
---|
793 | 790 | |
---|
794 | 791 | /* lvb is invalidated if only NL/CR locks remain */ |
---|
795 | | - if (!big_lock_exists) |
---|
| 792 | + if (!big_lkb) |
---|
796 | 793 | rsb_set_flag(r, RSB_VALNOTVALID); |
---|
797 | 794 | |
---|
798 | 795 | if (!r->res_lvbptr) { |
---|
.. | .. |
---|
801 | 798 | goto out; |
---|
802 | 799 | } |
---|
803 | 800 | |
---|
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); |
---|
807 | 804 | } else if (high_lkb) { |
---|
808 | 805 | r->res_lvbseq = high_lkb->lkb_lvbseq; |
---|
809 | 806 | memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen); |
---|