Bug#795867: vgchange has at least one race condition

Matthew Vernon mcv21 at cam.ac.uk
Mon Aug 17 15:26:52 UTC 2015


Package: lvm2
Version: 2.02.111-2.2
Severity: important
Tags: upstream

Hi,

I've been trying to track down an interaction between LVM and DRBD
that is sometimes resulting in filesystem corruption. As part of that,
I have discovered that vgchange -a n exits too soon sometimes -
i.e. it returns successfully before the relevant VG is actually
inactive.

The following shell script:

#!/bin/bash -e

for x in $(seq 400); do
    drbdadm primary mcv21
    vgchange -a y mcv21-vg
    vgchange -a n mcv21-vg
    drbdadm secondary mcv21
    echo $x
done

Will, most of the time (it's a stochastic failure, hence my feeling
there's a race) fail at some point roughly thus:

  0 logical volume(s) in volume group "mcv21-vg" now active
7: State change failed: (-12) Device is held open by someone
Command 'drbdsetup-84 secondary 7' terminated with exit code 11

i.e. drbdadm is unable to put the resource "mcv21" into secondary mode
because it's still held open, even though vgchange -a n should have
made it inactive before returning.

the relevant snippet of DRBD config for this resource:

resource mcv21 {
  device /dev/drbd7;
  disk /dev/guests/mwsig-mcv21;
  meta-disk internal;
[...]

Regards,

Matthew



More information about the pkg-lvm-maintainers mailing list