Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 519088

Summary: sys-fs/cryptsetup-1.6.5 - when the dm-crypt module is not loaded before configuring a mapping with libcryptsetup, the allow_discards option is not used
Product: Gentoo Linux Reporter: Konstantin (elxa) <ktrackfd>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Upstream fix for discard support

Description Konstantin (elxa) 2014-08-05 00:32:54 UTC
Quote from [1]:

Since cryptsetup 1.6.5, libcryptsetup fails to detect the kernel's
features on boot. In particular, whenever the dm-crypt module is not
loaded before configuring a mapping with libcryptsetup, the
allow_discards option is not used.

[1]: http://www.saout.de/pipermail/dm-crypt/2014-July/004213.html

The fix is upstream:

https://code.google.com/p/cryptsetup/source/detail?r=59fdf2a6bb461a39e6db6b7d515873419f8a8ada

Reproducible: Always

Steps to Reproduce:
1. rmmod dm_crypt
2. open luks device with discard support enabled
Actual Results:  
Cryptsetup does not enable discard support.

Expected Results:  
Cryptsetup enables discard support

Possible fixes:

1. Load dm_crypt prior to using cryptsetup
2. Compile dm_crypt into the kernel?
3. Apply the patch [1] from upstream
4. Wait for cryptsetup version 1.6.6

[1] https://code.google.com/p/cryptsetup/source/detail?r=59fdf2a6bb461a39e6db6b7d515873419f8a8ada
Comment 1 Konstantin (elxa) 2014-08-05 00:39:33 UTC
Created attachment 382292 [details, diff]
Upstream fix for discard support

My attempt at creating a patch usable for portage's epatch_user from https://code.google.com/p/cryptsetup/source/detail?r=59fdf2a6bb461a39e6db6b7d515873419f8a8ada

I booted my system with the patched cryptsetup binary and discard support is working again.
Comment 2 Konstantin (elxa) 2014-08-05 00:50:31 UTC
The ebuild for sys-fs/cryptsetup-1.6.5 does not pick up patches from /etc/portage/patches, because it does not call epatch_user. I copied the ebuild to my local overlay and patched the src_prepare section to call epatch_user:


@@ -53,6 +53,7 @@
 
 src_prepare() {
        sed -i '/^LOOPDEV=/s:$: || exit 0:' tests/{compat,mode}-test || die
+       epatch_user
        eautoreconf
 }
Comment 3 SpanKY gentoo-dev 2015-04-12 20:37:05 UTC
1.6.6 is in the tree that includes this fix