thin pool powerfail tests and data loss
Lakshmi Narasimhan Sundararajan <[email protected]> Sun, 8 Sep 2024 07:07:32 +0530
| Newsgroups | dev.linux.lists.lvm-devel |
|---|---|
| Message-ID | <CAHJKXw1LiySXw3+iPQAAq9VodwaL+oaqGTb6frpzdxVCoWGRwA@mail.gmail.com> |
Hi Team,
Greetings!
In my experiments with thin pool and power cycle tests, I find that
the inflight data has not been persisted, even if there is a sync
following write that got completed.
suppose we have the following bdev stackup:
bdevs(multi) -> mpath -> lvm pv -> lvm vg -> lvm thin pool -> multiple
thin vols.
Each of the thin vols that has inflight data, has a corresponding sync
checkpoint periodically. The expectation is all writes before the sync
are persisted to disk and can survive power reset tests.
Like below seq on many thin vols on the thin pool.
write -> write -> write -> fsync(fd) -> write -> write -> fsync(fd) -> ..etc
Now my code only does a fsync(fd) on the thin volume (block device directly).
There are no fs mounts on the volume.
Is this sufficient or should the thin pool (/dev/mapper/pool) also be
synced along?
What would be the proper sequence of sync actions to survive a power reset?
I am also trying to validate if this is an issue because mpath is
involved in any way(another dm layer in between), but would appreciate
some guidance in this
regard.
## setup versions ##
```
# lvm version
LVM version: 2.03.07(2) (2019-11-30)
Library version: 1.02.167 (2019-11-30)
Driver version: 4.41.0
Configuration: ./configure --build=x86_64-linux-gnu --prefix=/usr
--includedir=${prefix}/include --mandir=${prefix}/share/man
--infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var
--disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu
--libexecdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run
--disable-maintainer-mode --disable-dependency-tracking --exec-prefix=
--bindir=/bin --libdir=/lib/x86_64-linux-gnu --sbindir=/sbin
--with-usrlibdir=/usr/lib/x86_64-linux-gnu --with-optimisation=-O2
--with-cache=internal --with-device-uid=0 --with-device-gid=6
--with-device-mode=0660 --with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--with-default-locking-dir=/run/lock/lvm --with-thin=internal
--with-thin-check=/usr/sbin/thin_check
--with-thin-dump=/usr/sbin/thin_dump
--with-thin-repair=/usr/sbin/thin_repair --enable-applib
--enable-blkid_wiping --enable-cmdlib --enable-dmeventd
--enable-dbus-service --enable-lvmlockd-dlm --enable-lvmlockd-sanlock
--enable-lvmpolld --enable-notify-dbus --enable-pkgconfig
--enable-readline --enable-udev_rules --enable-udev_sync
# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
#
```
Best regards
LN