Hide Forgot
Description of problem: [root@host-126 ~]# lvcreate -L 4G -n corigin test Logical volume "corigin" created. [root@host-126 ~]# lvcreate --yes --type cache-pool --cachepolicy mq --cachemode writethrough -L 500M test/cpool Using default stripesize 64.00 KiB. Logical volume "cpool" created. [root@host-126 ~]# lvconvert --yes --type cache --cachepool test/cpool test/corigin Logical volume test/corigin is now cached. [root@host-126 ~]# lvs -a -o +devices,cachemode,cachepolicy LV VG Attr LSize Pool Origin Data% Meta% Cpy%Sync Devices CacheMode CachePolicy corigin test Cwi-a-C--- 4.00g [cpool] [corigin_corig] 0.00 1.07 0.00 corigin_corig(0) writethrough mq [corigin_corig] test owi-aoC--- 4.00g /dev/sdc1(0) [cpool] test Cwi---C--- 500.00m 0.00 1.07 0.00 cpool_cdata(0) writethrough mq [cpool_cdata] test Cwi-ao---- 500.00m /dev/sdc1(1028) [cpool_cmeta] test ewi-ao---- 8.00m /dev/sdc1(1026) [lvol0_pmspare] test ewi------- 8.00m /dev/sdc1(1024) [root@host-126 ~]# dmsetup table test-cpool_cdata: 0 1024000 linear 8:33 8423424 test-cpool_cmeta: 0 16384 linear 8:33 8407040 test-corigin_corig: 0 8388608 linear 8:33 2048 test-corigin: 0 8388608 cache 253:4 253:3 253:5 128 1 writethrough mq 0 [root@host-126 ~]# lvchange --cachepolicy cleaner --cachemode writeback test/corigin Logical volume test/corigin changed. [root@host-126 ~]# lvs -a -o +devices,cachemode,cachepolicy LV VG Attr LSize Pool Origin Data% Meta% Cpy%Sync Devices CacheMode CachePolicy corigin test Cwi-a-C--- 4.00g [cpool] [corigin_corig] 0.04 1.56 0.00 corigin_corig(0) writeback cleaner [corigin_corig] test owi-aoC--- 4.00g /dev/sdc1(0) [cpool] test Cwi---C--- 500.00m 0.04 1.56 0.00 cpool_cdata(0) writeback cleaner [cpool_cdata] test Cwi-ao---- 500.00m /dev/sdc1(1028) [cpool_cmeta] test ewi-ao---- 8.00m /dev/sdc1(1026) [lvol0_pmspare] test ewi------- 8.00m /dev/sdc1(1024) # Was not updated to "writeback" [root@host-126 ~]# dmsetup table test-cpool_cdata: 0 1024000 linear 8:33 8423424 test-cpool_cmeta: 0 16384 linear 8:33 8407040 test-corigin_corig: 0 8388608 linear 8:33 2048 test-corigin: 0 8388608 cache 253:4 253:3 253:5 128 1 writethrough cleaner 0 [root@host-126 ~]# vgchange -an test 0 logical volume(s) in volume group "test" now active [root@host-126 ~]# vgchange -ay test 1 logical volume(s) in volume group "test" now active # Was still not updated to "writeback" [root@host-126 ~]# dmsetup table test-cpool_cdata: 0 1024000 linear 8:33 8423424 test-cpool_cmeta: 0 16384 linear 8:33 8407040 test-corigin_corig: 0 8388608 linear 8:33 2048 test-corigin: 0 8388608 cache 253:3 253:2 253:4 128 1 writethrough cleaner 0 Version-Release number of selected component (if applicable): lvm2-2.02.166-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 lvm2-libs-2.02.166-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 lvm2-cluster-2.02.166-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 device-mapper-1.02.135-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 device-mapper-libs-1.02.135-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 device-mapper-event-1.02.135-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 device-mapper-event-libs-1.02.135-1.el7 BUILT: Wed Sep 28 02:26:52 CDT 2016 device-mapper-persistent-data-0.6.3-1.el7 BUILT: Fri Jul 22 05:29:13 CDT 2016 How reproducible: Everytime
Created attachment 1208891 [details] verbose lvchange attempt
writeback -> writethrough appears to work fine. [root@host-126 ~]# lvcreate -L 4G -n corigin test Logical volume "corigin" created. [root@host-126 ~]# lvcreate --yes --type cache-pool --cachepolicy mq --cachemode writeback -L 500M test/cpool Using default stripesize 64.00 KiB. Logical volume "cpool" created. [root@host-126 ~]# lvconvert --yes --type cache --cachepool test/cpool test/corigin Logical volume test/corigin is now cached. [root@host-126 ~]# lvs -a -o +devices,cachemode,cachepolicy LV VG Attr LSize Pool Origin Data% Meta% Cpy%Sync Devices CacheMode CachePolicy corigin test Cwi-a-C--- 4.00g [cpool] [corigin_corig] 0.00 1.07 0.00 corigin_corig(0) writeback mq [corigin_corig] test owi-aoC--- 4.00g /dev/sda1(0) [cpool] test Cwi---C--- 500.00m 0.00 1.07 0.00 cpool_cdata(0) writeback mq [cpool_cdata] test Cwi-ao---- 500.00m /dev/sda1(1028) [cpool_cmeta] test ewi-ao---- 8.00m /dev/sda1(1026) [lvol0_pmspare] test ewi------- 8.00m /dev/sda1(1024) [root@host-126 ~]# dmsetup table test-cpool_cdata: 0 1024000 linear 8:1 8423424 test-cpool_cmeta: 0 16384 linear 8:1 8407040 test-corigin_corig: 0 8388608 linear 8:1 2048 test-corigin: 0 8388608 cache 253:4 253:3 253:5 128 1 writeback mq 0 [root@host-126 ~]# lvchange --cachepolicy cleaner --cachemode writethrough test/corigin Flushing 1 blocks for cache test/corigin. Logical volume test/corigin changed. [root@host-126 ~]# lvs -a -o +devices,cachemode,cachepolicy LV VG Attr LSize Pool Origin Data% Meta% Cpy%Sync Devices CacheMode CachePolicy corigin test Cwi-a-C--- 4.00g [cpool] [corigin_corig] 0.00 1.56 0.00 corigin_corig(0) writethrough cleaner [corigin_corig] test owi-aoC--- 4.00g /dev/sda1(0) [cpool] test Cwi---C--- 500.00m 0.00 1.56 0.00 cpool_cdata(0) writethrough cleaner [cpool_cdata] test Cwi-ao---- 500.00m /dev/sda1(1028) [cpool_cmeta] test ewi-ao---- 8.00m /dev/sda1(1026) [lvol0_pmspare] test ewi------- 8.00m /dev/sda1(1024) [root@host-126 ~]# dmsetup table test-cpool_cdata: 0 1024000 linear 8:1 8423424 test-cpool_cmeta: 0 16384 linear 8:1 8407040 test-corigin_corig: 0 8388608 linear 8:1 2048 test-corigin: 0 8388608 cache 253:4 253:3 253:5 128 1 writethrough cleaner 0
Yep - this is intended logic - 'cleaner' policy requires 'writethrough' cache mode to be used. It doesn't work in writeback and may eventually cause endless clearing loop. Once the 'cleaner' policy is switched to 'smq/mq' it goes to the right cache mode. If this is not documented somewhere - like it's RFE for man page enhancement. The command code works properly and does the right thing.