Bug 1753597

Summary: LUKS2 reencryption ignores activation flags (one-time and also persistent)
Product: Red Hat Enterprise Linux 8 Reporter: Ondrej Kozina <okozina>
Component: cryptsetupAssignee: Ondrej Kozina <okozina>
Status: CLOSED ERRATA QA Contact: guazhang <guazhang>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: agk, guazhang, jbrassow, mbroz, okozina, prajnoha, rhandlin
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cryptsetup-2.2.2-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:54:37 UTC 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:
Bug Depends On: 1757783    
Bug Blocks:    

Description Ondrej Kozina 2019-09-19 11:33:13 UTC
Description of problem:

Activate regular LUKS2 device by "cryptsetup open /dev/sdx sdx_crypt" command and add one of activation flags:
--allow-discards or --perf-submit_from_crypt_cpus or --perf-same_cpu_crypt.

You'll see those flags in "dmsetup table" output related to that device (--allow-discards example):

sdx_crypt: 0 52185344 crypt aes-xts-plain64 :64:logon:cryptsetup:a6b771cd-69d3-42fd-b8ee-bde7dd3a7ec5-d1 0 8:2 32768 1 allow_discards
                                             ^^^^^^^^^^^^^^
Or you may run "cryptsetup status sdx_crypt" command to see list effective activation flags (see 'flags:' line).

During online reencryption those flag(s) disappear on sdx_crypt-overlay mapping and will not reappear until reencryption gets finished. Also those flags reappear only if those were 'persistent' flags stored in LUKS2 metadata.
One time activation flags disappear for good.

Persistent flags can be stored in LUKS2 metadata by either:
cryptsetup open /dev/sdx sdx_crypt --allow-discrads --persistent (works on inactive device only)
-or-
cryptsetup refresh sdx_crypt --allow-discrads --persistent (works on active device only)

Persistent flags can be listed by following command:

cryptsetup luksDump /dev/sdx | head:
Version:       	2
Epoch:         	16802
Metadata area: 	16384 [bytes]
Keyslots area: 	16744448 [bytes]
UUID:          	a6b771cd-69d3-42fd-b8ee-bde7dd3a7ec5
Label:         	(no label)
Subsystem:     	(no subsystem)
Flags:       	allow-discards 
^^^^^^          ^^^^^^^^^^^^^^^

Version-Release number of selected component (if applicable):
cryptsetup-2.2.0-2.el8

Comment 2 guazhang@redhat.com 2019-11-25 07:14:42 UTC
Hello


cryptsetup-2.2.2-1.el8.x86_64

# cryptsetup luksDump /dev/sdk1
LUKS header information
Version:       	2
Epoch:         	5
Metadata area: 	16384 [bytes]
Keyslots area: 	16744448 [bytes]
UUID:          	d4e00ae2-a7a4-456b-9d29-60c6096d2801
Label:         	(no label)
Subsystem:     	(no subsystem)
Flags:       	allow-discards 


so move to verified

thanks
guazhang

Comment 4 errata-xmlrpc 2020-04-28 16:54:37 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, 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:1848