RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1796677 - high|low_watermarks do not appear to be valid arguments for dm-writecache targets
Summary: high|low_watermarks do not appear to be valid arguments for dm-writecache tar...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lvm2
Version: 8.2
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: 8.0
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-30 22:54 UTC by Corey Marthaler
Modified: 2023-09-15 00:21 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.03.08-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 02:00:20 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4546 0 None None None 2020-11-04 02:00:43 UTC

Description Corey Marthaler 2020-01-30 22:54:09 UTC
Description of problem:
   dm-writecache settings

       Tunable parameters can be passed to the dm-writecache kernel module using the --cachesettings option when caching is started, e.g.

       · high_watermark = <count>
         Start writeback when the number of used blocks reach this watermark

       · low_watermark = <count>
         Stop writeback when the number of used blocks drops below this watermark


# HIGH
[root@hayes-02 ~]# lvcreate --wipesignatures y  -L 4G -n display_writecache writecache_sanity @slow
  Logical volume "display_writecache" created.
[root@hayes-02 ~]# lvcreate  -L 4G -n pool writecache_sanity @fast
  Logical volume "pool" created.

[root@hayes-02 ~]# lvconvert --yes --type writecache --cachesettings 'high_watermark=1470' --cachevol writecache_sanity/pool writecache_sanity/display_writecache
  Logical volume writecache_sanity/display_writecache now has write cache.
[root@hayes-02 ~]# lvchange -ay writecache_sanity
  device-mapper: reload ioctl on  (253:2) failed: Invalid argument

Jan 30 16:43:55 hayes-02 kernel: device-mapper: table: 253:2: writecache: Invalid optional argument
Jan 30 16:43:55 hayes-02 kernel: device-mapper: ioctl: error adding target to table


# LOW
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachesettings 'low_watermark=1470' --cachevol writecache_sanity/pool writecache_sanity/display_writecache
  Logical volume writecache_sanity/display_writecache now has write cache.
[root@hayes-02 ~]# lvchange -ay  writecache_sanity
  device-mapper: reload ioctl on  (253:2) failed: Invalid argument

[ 7100.552240] device-mapper: table: 253:2: writecache: Invalid optional argument
[ 7100.560341] device-mapper: ioctl: error adding target to table


Version-Release number of selected component (if applicable):
kernel-4.18.0-173.el8    BUILT: Fri Jan 24 06:02:03 CST 2020
lvm2-2.03.07-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
lvm2-libs-2.03.07-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
lvm2-dbusd-2.03.07-1.el8    BUILT: Mon Dec  2 00:12:23 CST 2019
lvm2-lockd-2.03.07-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
boom-boot-1.0-1.el8    BUILT: Fri Nov 29 05:18:30 CST 2019
device-mapper-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-libs-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-event-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-event-libs-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-persistent-data-0.8.5-3.el8    BUILT: Wed Nov 27 07:05:21 CST 2019


How reproducible:
Everytime

Comment 1 Mike Snitzer 2020-01-31 22:37:29 UTC
(In reply to Corey Marthaler from comment #0)
> Description of problem:
>    dm-writecache settings
> 
>        Tunable parameters can be passed to the dm-writecache kernel module
> using the --cachesettings option when caching is started, e.g.
> 
>        · high_watermark = <count>
>          Start writeback when the number of used blocks reach this watermark
> 
>        · low_watermark = <count>
>          Stop writeback when the number of used blocks drops below this
> watermark
> 

Not sure who documented this.  Or if lvm2 meant to present a different interface than the kernel interface?  but the kernel code expects percentages (0-100):

                } else if (!strcasecmp(string, "high_watermark") && opt_params >= 1) {
                        string = dm_shift_arg(&as), opt_params--;
                        if (sscanf(string, "%d%c", &high_wm_percent, &dummy) != 1)
                                goto invalid_optional;
                        if (high_wm_percent < 0 || high_wm_percent > 100)
                                goto invalid_optional;
                        wc->high_wm_percent_set = true;
                } else if (!strcasecmp(string, "low_watermark") && opt_params >= 1) {
                        string = dm_shift_arg(&as), opt_params--;
                        if (sscanf(string, "%d%c", &low_wm_percent, &dummy) != 1)
                                goto invalid_optional;
                        if (low_wm_percent < 0 || low_wm_percent > 100)
                                goto invalid_optional;
                        wc->low_wm_percent_set = true;
                }


> # HIGH
> [root@hayes-02 ~]# lvconvert --yes --type writecache --cachesettings
> 'high_watermark=1470' --cachevol writecache_sanity/pool
> writecache_sanity/display_writecache
...
> # LOW
> [root@hayes-02 ~]# lvconvert --yes --type writecache --cachesettings
> 'low_watermark=1470' --cachevol writecache_sanity/pool
> writecache_sanity/display_writecache

provided value needs to be >= 0 and <= 100.  Again, they are percentages.

Comment 2 David Teigland 2020-02-03 17:22:49 UTC
I documented it incorrectly, man page fixed here:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=64a82a1c79a4aaef5359150f960932aee4df1982

Comment 4 Corey Marthaler 2020-02-20 23:45:11 UTC
Just to be clear, is QA to verify the man page change only? I see that LVM still doesn't check of the values are between 0-100.

Man page is fixed:

lvmcache(7)
       
       Tunable options are:

       · high_watermark = <percent>

         Start writeback when the writecache usage reaches this percent (0-100).

       · low_watermark = <percent>

         Stop writeback when the writecache usage reaches this percent (0-100)

Comment 5 David Teigland 2020-02-25 16:35:37 UTC
verifying values between 0 and 100:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=84eab461c843e2018b6ff73a9af8140e27cde391

# lvconvert --type writecache --cachevol fast --cachesettings high_watermark=101 test/main
  Invalid setting: high_watermark
  Invalid writecache settings.

# lvconvert --type writecache --cachevol fast --cachesettings low_watermark=-1000 test/main
  Invalid setting: low_watermark
  Invalid writecache settings.

Comment 6 Corey Marthaler 2020-02-25 17:05:55 UTC
Marian, 

Can we get the above mentioned fix included in the official build for this bug (as it's not yet in lvm2-2.03.08-2.el8), Thanks.

[root@hayes-02 ~]# lvs
  LV              VG                Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  cworigin        writecache_sanity -wi------- 4.00g                                                    
  test_writecache writecache_sanity -wi------- 2.00g
                                                    
[root@hayes-02 ~]# lvconvert --test --yes --type writecache --cachesettings 'high_watermark=101' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Logical volume writecache_sanity/cworigin now has write cache.
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachesettings 'high_watermark=101' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  Logical volume writecache_sanity/cworigin now has write cache.

[root@hayes-02 ~]# lvchange -ay writecache_sanity/cworigin
  device-mapper: reload ioctl on  (253:2) failed: Invalid argument

Feb 25 11:02:06 hayes-02 kernel: device-mapper: table: 253:2: writecache: Invalid optional argument
Feb 25 11:02:06 hayes-02 kernel: device-mapper: ioctl: error adding target to table

Comment 7 Jonathan Earl Brassow 2020-02-26 04:03:39 UTC
(In reply to David Teigland from comment #5)
> verifying values between 0 and 100:
> https://sourceware.org/git/?p=lvm2.git;a=commit;
> h=84eab461c843e2018b6ff73a9af8140e27cde391
> 
> # lvconvert --type writecache --cachevol fast --cachesettings
> high_watermark=101 test/main
>   Invalid setting: high_watermark
>   Invalid writecache settings.
> 
> # lvconvert --type writecache --cachevol fast --cachesettings
> low_watermark=-1000 test/main
>   Invalid setting: low_watermark
>   Invalid writecache settings.

I didn't see an accompanying test suite addition for this... could we get one?

Comment 8 Marian Csontos 2020-02-26 10:02:46 UTC
(In reply to Corey Marthaler from comment #6)
> Marian, 
> 
> Can we get the above mentioned fix included in the official build for this
> bug (as it's not yet in lvm2-2.03.08-2.el8), Thanks.

No problem, but we do need an exception now, and I am asking for one.

The fix itself is a no risk usability improvement, just rejecting invalid values.

Comment 13 Corey Marthaler 2020-06-11 03:18:37 UTC
Fix verified in the latest rpms.


kernel-4.18.0-211.el8    BUILT: Thu Jun  4 03:33:39 CDT 2020
lvm2-2.03.09-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
lvm2-libs-2.03.09-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
lvm2-dbusd-2.03.09-2.el8    BUILT: Fri May 29 11:32:49 CDT 2020
lvm2-lockd-2.03.09-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
boom-boot-1.1-1.el8    BUILT: Thu May 14 08:11:56 CDT 2020
device-mapper-1.02.171-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
device-mapper-libs-1.02.171-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
device-mapper-event-1.02.171-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020
device-mapper-event-libs-1.02.171-2.el8    BUILT: Fri May 29 11:29:58 CDT 2020



1B. Test that a highwater mark needs to be higher than low watermark
lvconvert --test --yes --type writecache --cachesettings 'low_watermark=56 high_watermark=3' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  High watermark must be greater than low watermark.
  Invalid writecache settings.
lvconvert --test --yes --type writecache --cachesettings 'low_watermark=56 high_watermark=56' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  High watermark must be greater than low watermark.
  Invalid writecache settings.
lvconvert --test --yes --type writecache --cachesettings 'low_watermark=56 high_watermark=57' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.

1C. Test that a low water mark shouldnt be allowed if over 100%
lvconvert --test --yes --type writecache --cachesettings 'low_watermark=156' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Invalid setting: low_watermark
  Invalid writecache settings.

1D. Test that a low water mark is numeric
lvconvert --test --yes --type writecache --cachesettings 'low_watermark=abc' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Invalid setting: low_watermark
  Invalid writecache settings.

1E. Test that a high water mark shouldnt be allowed if over 100%
lvconvert --test --yes --type writecache --cachesettings 'high_watermark=345' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Invalid setting: high_watermark
  Invalid writecache settings.

1F. Test that a high water mark is numeric
lvconvert --test --yes --type writecache --cachesettings 'high_watermark=DEF' --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Invalid setting: high_watermark
  Invalid writecache settings.

Comment 16 errata-xmlrpc 2020-11-04 02:00:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4546

Comment 18 Red Hat Bugzilla 2023-09-15 00:21:06 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


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