[linux-lvm] cache_check --clear-needs-check-flag does not clear needs_check flag?
Dennis Schridde
devurandom at gmx.net
Sun Dec 6 21:01:37 UTC 2020
Hello!
A cached logical volume of mine cannot be activated anymore:
$ sudo vgchange -ay
device-mapper: reload ioctl on (253:6) failed: Invalid argument
0 logical volume(s) in volume group "vg_ernie" now active
dmesg logs:
device-mapper: cache: 253:6: unable to switch cache to write mode until
repaired.
device-mapper: cache: 253:6: switching cache to read-only mode
device-mapper: table: 253:6: cache: Unable to get write access to metadata,
please check/repair metadata.
device-mapper: ioctl: error adding target to table
The code in question seems to be: https://github.com/torvalds/linux/blob/v5.8/
drivers/md/dm-cache-target.c#L957-L964
Hence I set out to check the cache and, if it is clean, clear the needs_check
flag:
$ sudo lvchange -ay vg_ernie/lv_cache
Do you want to activate component LV in read-only mode? [y/n]: y
Allowing activation of component LV.
$ sudo cache_check /dev/vg_ernie/lv_cache
examining superblock
examining mapping array
examining hint array
examining discard bitset
$ sudo cache_check --clear-needs-check-flag /dev/vg_ernie/lv_cache
examining superblock
examining mapping array
examining hint array
examining discard bitset
$ sudo lvchange -an vg_ernie/lv_cache
But the problem persists:
$ sudo vgchange -ay
device-mapper: reload ioctl on (253:6) failed: Invalid argument
0 logical volume(s) in volume group "vg_ernie" now active
I tried again in read/write mode, in case that would make a difference /
silently fail:
$ sudo lvchange -ay vg_ernie/lv_cache
Do you want to activate component LV in read-only mode? [y/n]: n
$ sudo cache_check --clear-needs-check-flag /dev/vg_ernie/lv_cache
examining superblock
examining mapping array
examining hint array
examining discard bitset
$ sudo lvchange -an vg_ernie/lv_cache
With the same results:
$ sudo vgchange -ay
device-mapper: reload ioctl on (253:6) failed: Invalid argument
0 logical volume(s) in volume group "vg_ernie" now active
A bit puzzling is that the status of the needs_check flag appears to be
"unknown":
$ sudo lvs -a -o +lv_check_needed
LV VG Attr LSize Pool
Origin Data% Meta% Move Log Cpy%Sync Convert CheckNeeded
[lv_cache] vg_ernie CRi-a-C--- 232.88g
unknown
lv_system vg_ernie Cwi---C--- <1.82t [lv_cache]
[lv_system_corig]
unknown
[lv_system_corig] vg_ernie owi---C--- <1.82t
unknown
The live system I am running these commands from is a Fedora 33:
$ uname -a
Linux localhost-live 5.8.15-301.fc33.x86_64 #1 SMP Thu Oct 15 16:58:06 UTC
2020 x86_64 x86_64 x86_64 GNU/Linux
$ sudo lvm version
LVM version: 2.03.10(2) (2020-08-09)
Library version: 1.02.173 (2020-08-09)
Driver version: 4.42.0
Configuration: ./configure --build=x86_64-redhat-linux-gnu --
host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --
sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/
lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib
--mandir=/usr/share/man --infodir=/usr/share/info --with-default-dm-run-dir=/
run --with-default-run-dir=/run/lvm --with-default-pid-dir=/run --with-
default-locking-dir=/run/lock/lvm --with-usrlibdir=/usr/lib64 --enable-fsadm
--enable-write_install --with-user= --with-group= --with-device-uid=0 --with-
device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-cmdlib --
enable-dmeventd --enable-blkid_wiping --with-cluster=internal --enable-
cmirrord --with-udevdir=/usr/lib/udev/rules.d --enable-udev_sync --with-
thin=internal --with-cache=internal --enable-lvmpolld --enable-lvmlockd-dlm --
enable-lvmlockd-dlmcontrol --enable-lvmlockd-sanlock --enable-dbus-service --
enable-notify-dbus --enable-dmfilemapd --with-writecache=internal --with-
vdo=internal --with-vdo-format=/usr/bin/vdoformat --disable-silent-rules
Is it possible that `cache_check --clear-needs-check-flag does not clear
needs_check flag` does not actually clear the needs_check flag in my case?
Any help to get the system back online (without data loss, if possible) is
appreciated!
Best regards,
Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20201206/24ce41c0/attachment.sig>
More information about the linux-lvm
mailing list