Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 519088 - 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
Summary: sys-fs/cryptsetup-1.6.5 - when the dm-crypt module is not loaded before confi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-08-05 00:32 UTC by Konstantin (elxa)
Modified: 2015-04-12 20:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Upstream fix for discard support (0001-Properly-allow-activation-of-discard-even-if-dm_cryp.patch,2.22 KB, patch)
2014-08-05 00:39 UTC, Konstantin (elxa)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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