#885660 lvm2: vgchange -ay has a race condition in symlink creation

Package:
lvm2
Source:
lvm2
Description:
Linux Logical Volume Manager
Submitter:
"Karl O. Pinc"
Date:
2017-12-30 20:27:06 UTC
Severity:
normal
#885660#5
Date:
2017-12-28 22:51:08 UTC
From:
To:
Hi,

After upgrade from Jessie to Stretch I now see a race condition in
'vgchange -ay'.

I've a shell script that does a 'vgchange -ay' and on success proceeds
to mount the newly active logical volumes.  Now, about 1 in 10 times,
the symlinks in /dev/$VGNAME/$LVNAME (and
/dev/mapper/${VGNAME}-${LVNAME}, I've tried both) do not yet exist
after vgchange exits and the mount commands fail.  Looking at /dev/
afterwards shows the symlinks do exist, hence a race condition.

The workaround I am trying is to sleep 1 second after vgchange.
(This is lame.  Other suggestions would be appreciated. :)

See also Bug#795867.

#885660#10
Date:
2017-12-30 20:13:09 UTC
From:
To:
FYI.  A 1 second sleep is not enough.  A 2 second sleep
has resulted in some LVs being available and some not.

I am trying a 3 second sleep and expect that to be
sufficient.

Regards,

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein