Bug 1383427 - dmsetup does not reflect the changed cache mode when moving from writethrough -> writeback
Summary: dmsetup does not reflect the changed cache mode when moving from writethrough...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Zdenek Kabelac
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-10 15:07 UTC by Corey Marthaler
Modified: 2021-09-03 12:54 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-22 20:17:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
verbose lvchange attempt (174.58 KB, text/plain)
2016-10-10 15:21 UTC, Corey Marthaler
no flags Details

Description Corey Marthaler 2016-10-10 15:07:52 UTC
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

Comment 2 Corey Marthaler 2016-10-10 15:21:01 UTC
Created attachment 1208891 [details]
verbose lvchange attempt

Comment 3 Corey Marthaler 2016-10-10 15:32:46 UTC
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

Comment 4 Zdenek Kabelac 2017-01-22 20:17:40 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.