]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
generic/459: prevent collisions between test VMs backed by a shared disk pool
authorDarrick J. Wong <djwong@kernel.org>
Tue, 26 Nov 2024 20:27:29 +0000 (12:27 -0800)
committerZorro Lang <zlang@kernel.org>
Thu, 28 Nov 2024 13:39:49 +0000 (21:39 +0800)
commit0c01033c834fe8c13d635757b88793571e1a415e
treedf734db07f172bd2d2cfd55f43bdbb3e01d24a95
parentab1ece9ee32dd45816374e41ffe06bdef0534728
generic/459: prevent collisions between test VMs backed by a shared disk pool

If you happen to be running fstests on a bunch of VMs and the VMs all
have access to a shared disk pool, then it's possible that two VMs could
be running generic/459 at exactly the same time.  In that case, it's a
VERY bad thing to have two nodes trying to create an LVM volume group
named "vg_459" because one node will succeed, after which the other node
will see the vg_459 volume group that it didn't create:

  A volume group called vg_459 already exists.
  Logical volume pool_459 already exists in Volume group vg_459.
  Logical Volume "lv_459" already exists in volume group "vg_459"

But then, because this is bash, we don't abort the test script and
continue executing.  If we're lucky this fails when /dev/vg_459/lv_459
disappears before mkfs can run:

  Error accessing specified device /dev/mapper/vg_459-lv_459: No such file or directory
  Usage: mkfs.xfs

But in the bad case both nodes write filesystems to the same device and
then they trample all over each other.  Fix this by adding the hostname
and pid to all the LVM names so that they won't collide.

Fixes: 461dad511f6b91 ("generic: Test filesystem lockup on full overprovisioned dm-thin")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/459