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
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.
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 }
1.6.6 is in the tree that includes this fix