diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 8ba8b3ccb..9023bccc1 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -359,7 +359,7 @@ struct volume_group *lvmcache_get_saved_vg(const char *vgid, int precommitted) * By just dropping old, we force a subsequent request for old to * reread it rather than just using new. */ - if (vginfo->saved_vg_old && (vginfo->saved_vg_old < vg->seqno)) { + if (vginfo->saved_vg_old && (vginfo->saved_vg_old->seqno < vg->seqno)) { log_debug_cache("lvmcache: drop saved_vg_old because new invalidates"); _saved_vg_free(vginfo, 1, 0); } diff --git a/lib/label/label.c b/lib/label/label.c index 97e2a0bf9..a9818092a 100644 --- a/lib/label/label.c +++ b/lib/label/label.c @@ -946,7 +946,14 @@ bool dev_write_bytes(struct device *dev, off_t start, size_t len, void *data) } if (!bcache_write_bytes(scan_bcache, dev->bcache_fd, start, len, data)) { - log_error("dev_write_bytes %s at %u failed invalidate fd %d", + log_error("dev_write_bytes %s at %u bcache write failed invalidate fd %d", + dev_name(dev), (uint32_t)start, dev->bcache_fd); + label_scan_invalidate(dev); + return false; + } + + if (!bcache_flush(scan_bcache)) { + log_error("dev_write_bytes %s at %u bcache flush failed invalidate fd %d", dev_name(dev), (uint32_t)start, dev->bcache_fd); label_scan_invalidate(dev); return false; @@ -982,7 +989,14 @@ bool dev_write_zeros(struct device *dev, off_t start, size_t len) } if (!bcache_write_zeros(scan_bcache, dev->bcache_fd, start, len)) { - log_error("dev_write_zeros %s at %u failed invalidate fd %d", + log_error("dev_write_zeros %s at %u bcache write failed invalidate fd %d", + dev_name(dev), (uint32_t)start, dev->bcache_fd); + label_scan_invalidate(dev); + return false; + } + + if (!bcache_flush(scan_bcache)) { + log_error("dev_write_zeros %s at %u bcache flush failed invalidate fd %d", dev_name(dev), (uint32_t)start, dev->bcache_fd); label_scan_invalidate(dev); return false; diff --git a/test/shell/lvmetad-disabled.sh b/test/shell/lvmetad-disabled.sh index cba73d682..0f180c725 100644 --- a/test/shell/lvmetad-disabled.sh +++ b/test/shell/lvmetad-disabled.sh @@ -24,11 +24,13 @@ test ! -e "$LVM_LVMETAD_PIDFILE" aux lvmconf "global/use_lvmetad = 0" -pvcreate --metadatatype 1 "$dev1" +pvcreate "$dev1" pvcreate "$dev2" -vgcreate -M1 $vg1 "$dev1" +vgcreate $vg1 "$dev1" vgcreate $vg2 "$dev2" +lvcreate -n $lv1 -l1 $vg1 + pvs 2>&1 | tee out grep "$dev1" out grep "$dev2" out @@ -43,10 +45,21 @@ while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait f test -e "$LVM_LVMETAD_PIDFILE" cp "$LVM_LVMETAD_PIDFILE" LOCAL_LVMETAD -pvscan --cache 2>&1 | tee out +pvscan --cache +pvs 2>&1 | tee out +grep "$dev1" out +grep "$dev2" out +not grep "WARNING: Not using lvmetad" out + +# We don't care about the repair, and we know it's +# not valid on this lv. We are just running repair +# because we know one side effect is to disable lvmetad. +# FIXME: we should install lvmetactl so that we can +# use that to directly disable lvmetad for tests like this. +not lvconvert --repair $vg1/$lv1 2>&1 | tee out grep "WARNING: Disabling lvmetad cache" out -pvs 2>&1 | tee out +pvs -vvvv 2>&1 | tee out grep "$dev1" out grep "$dev2" out grep "WARNING: Not using lvmetad" out @@ -56,7 +69,8 @@ grep $vg1 out grep $vg2 out grep "WARNING: Not using lvmetad" out -vgremove $vg1 2>&1 | tee out +vgchange -an $vg1 +vgremove -y $vg1 2>&1 | tee out grep "WARNING: Not using lvmetad" out pvremove "$dev1" 2>&1 | tee out diff --git a/test/shell/pool-labels.sh b/test/shell/pool-labels.sh deleted file mode 100644 index e7de6fcfc..000000000 --- a/test/shell/pool-labels.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2007 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing to use, -# modify, copy, or redistribute it subject to the terms and conditions -# of the GNU General Public License v.2. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# lvmetad does not handle pool labels so skip test. -SKIP_WITH_LVMLOCKD=1 -SKIP_WITH_LVMETAD=1 -SKIP_WITH_LVMPOLLD=1 - -. lib/inittest - -env printf "" || skip # skip if printf is not available - -# create the old GFS pool labeled linear devices -create_pool_label_() -{ - # FIXME - # echo -e is bashism, dash builtin sh doesn't do \xNN in printf either - # printf comes from coreutils, and is probably not posix either - env printf "\x01\x16\x70\x06\x5f\xcf\xff\xb9\xf8\x24\x8apool1" | dd of="$2" bs=5 seek=1 conv=notrunc - env printf "\x04\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x0$1\x68\x01\x16\x70\x00\x00\x00\x00\x00\x06\x5f\xd0" | dd of=$2 bs=273 seek=1 conv=notrunc - aux notify_lvmetad "$2" -} - - -aux prepare_devs 2 - -create_pool_label_ 0 "$dev1" -create_pool_label_ 1 "$dev2" - -# check that pvcreate fails without -ff on the pool device -not pvcreate "$dev1" - -# check that vgdisplay and pvcreate -ff works with the pool device -vgdisplay --config 'global { locking_type = 0 }' -aux disable_dev "$dev2" -# FIXME! since pool1 cannot be opened, vgdisplay gives error... should we say -# "not" there instead, checking that it indeed does fail? -vgdisplay --config 'global { locking_type = 0 }' || true -pvcreate -ff -y "$dev1" diff --git a/test/shell/vgcreate-usage.sh b/test/shell/vgcreate-usage.sh index 16117c346..ee7dd9947 100644 --- a/test/shell/vgcreate-usage.sh +++ b/test/shell/vgcreate-usage.sh @@ -68,10 +68,6 @@ vgcreate $vg "$dev1" "$dev2" not vgcreate $vg "$dev1" "$dev2" vgremove -ff $vg -#COMM 'vgcreate rejects MaxLogicalVolumes > 255' -not vgcreate --metadatatype 1 --maxlogicalvolumes 1024 $vg "$dev1" "$dev2" 2>err -grep "Number of volumes may not exceed 255" err - #COMM "vgcreate fails when the only pv has --metadatacopies 0" not vgcreate $vg "$dev3"