Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 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