1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: use remount-ro for extfs

Avoid showing kernel warn of umounting broken fs.
This commit is contained in:
Zdenek Kabelac 2015-09-18 15:08:28 +02:00
parent 330d584617
commit 7d1dd5f52d

View File

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
# Copyright (C) 2010-2015 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
@ -31,18 +31,23 @@ lvcreate -s -L4 -n snap $vg/base
lvchange --monitor y $vg/snap
mkdir "$mntdir"
mount "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
# Use remount-ro to avoid logging kernel WARNING
mount -o errors=remount-ro "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 1
cat /proc/mounts | grep "$mntdir"
not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=5 conv=fdatasync
# overfill 4M snapshot (with metadata)
not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=4 conv=fdatasync
# Should be nearly instant check of dmeventd for invalid snapshot.
# Wait here for umount and open_count drops to 0 as it may
# take a while to finalize umount operation (it might be already
# removed from /proc/mounts, but still opened).
for i in {1..100}; do
test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 0 && break
sleep .1
test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 0 && break
done
cat /proc/mounts | not grep "$mntdir"