Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-62921

lvremove failure in a shared VG can leave LVs without locks

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • rhel-9.6
    • rhel-9.5
    • lvm2
    • None
    • lvm2-2.03.28-1.el9
    • No
    • Important
    • rhel-sst-logical-storage
    • ssg_filesystems_storage_and_HA
    • 12
    • 15
    • 5
    • Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None

          lvremove: fix failed remove of all LVs in shared VG
          
          commit a125a3bb505cc "lv_remove: reduce commits for removed LVs"
          changed "lvremove <vgname>" from removing one LV at a time,
          to removing all LVs in one vg write/commit.  It also changed
          the behavior if some of the LVs could not be removed, from
          removing those LVs that could be removed, to removing nothing
          if any LV could not be removed.  This caused a regression in
          shared VGs using sanlock, in which the on-disk lease was
          removed for any LV that could be removed, even if the command
          decided to remove nothing.  This would leave LVs without a
          valid ondisk lease, and "lock failed: error -221" would be
          returned for any command attempting to lock the LV.
          
          Fix this by not freeing the on-disk leases until after the
          command has decided to go ahead and remove everything, and
          has written the VG metadata.
          
          Before the fix:
          
          node1: lvchange -ay vg/lv1
          node2: lvchange -ay vg/lv2
          
          node1: lvs
            lv1  test -wi-a----- 4.00m
            lv2  test -wi------- 4.00m
          node2: lvs
            lv1  test -wi------- 4.00m
            lv2  test -wi-a----- 4.00m
          
          node1: lvremove -y vg/lv1 vg/lv2
            LV locked by other host: vg/lv2
          
          (lvremove removed neither of the LVs, but it freed
          the lock for lv1, which could have been removed
          except for the proper locking failure on lv2.)
          
          node1: lvs
            lv1  test -wi------- 4.00m
            lv2  test -wi------- 4.00m
          
          node1: lvremove -y vg/lv1
          LV vg/lv1 lock failed: error -221
          
          (The lock for lv1 is gone, so nothing can be done with it.)
      
      

      upstream fix:
      https://gitlab.com/lvmteam/lvm2/-/commit/6ab2a22fcf9284fea46dd10c94bcc931eb0902f7

              cmarthal@redhat.com Corey Marthaler
              teigland@redhat.com David Teigland
              lvm-team lvm-team
              Cluster QE Cluster QE
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: