Bug 2004215

Summary: Cache table line might be incorrectly generated
Product: [Community] LVM and device-mapper Reporter: Zdenek Kabelac <zkabelac>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: POST --- Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, prajnoha, thornber, zkabelac
Version: unspecifiedFlags: pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zdenek Kabelac 2021-09-14 17:54:32 UTC
Description of problem:

When caching an LV - the table line for such LV might be incorrectly generated.

This however happen only when user supplies some extra cache setting  - which in case of SMQ policy is only 'migration_threshold' which has got explicit handling.

The lvm2 used this incorrect evaluation to get number of args for caching target as discovered here:  https://github.com/lvmteam/lvm2/issues/55


Version-Release number of selected component (if applicable):
2.03.13


Steps to Reproduce:
1. lvcreate -L10 -n lv vg 
2. lvcreate -H -L10 vg/lvol0 --cachepolicy mq --cachesettings 'read_promote_adjustment=10  migration_threshold=4096'

Checking the table give 4 args to target:

metadata2 writethrough mq 4 migration_threshold 4096 read_promote_adjustment 10
                         ^^^ 

Additional info:

Majority of users actually never uses any --cachesettings - and default SMQ accepts only migration_threshold - so the bug was basically unnoticeable.

Comment 1 Zdenek Kabelac 2021-09-14 18:06:38 UTC
Solved upstream this way:

Avoids supplying unsupported cache settings from  MQ & SMQ cache policies
which avoid hitting unpleasant suspend errors:

https://listman.redhat.com/archives/lvm-devel/2021-September/msg00015.html


Enhance revert path when cache table load fails on lvcreate:

https://listman.redhat.com/archives/lvm-devel/2021-September/msg00019.html



Fix actual parentheses errors:

https://listman.redhat.com/archives/lvm-devel/2021-September/msg00035.html