[linux-lvm] cache_check --clear-needs-check-flag does not clear needs_check flag?

Zdenek Kabelac zkabelac at redhat.com
Wed Dec 9 11:05:13 UTC 2020


Dne 06. 12. 20 v 22:01 Dennis Schridde napsal(a):
> 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.

As said - by component activation you will get 'read-only' volume
thus you cannot do 'in-place' changes this way.


> 
> 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

It seems you are using  'cvol' instead of 'cpool' solution which has been 
evolving and you will need a newer lvm2 version.

If you want to using caching with the version of lvm2 you have - you will
need to use cpools  (which are a bit faster anyway).

Regards

Zdenek




More information about the linux-lvm mailing list