Bug 198863 - [patch] geli: TRIM passthru
Summary: [patch] geli: TRIM passthru
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
: 182713 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-03-24 02:18 UTC by fullermd
Modified: 2019-11-30 16:09 UTC (History)
6 users (show)

See Also:


Attachments
Patch to geli to enable passthru (12.32 KB, patch)
2015-03-24 02:18 UTC, fullermd
no flags Details | Diff
Patch to swapon for fstab auto-ELI (1.55 KB, patch)
2015-03-27 10:47 UTC, fullermd
no flags Details | Diff
Patch to geli to enable passthru (12.74 KB, patch)
2015-05-10 16:57 UTC, fullermd
no flags Details | Diff
Patch to geli to enable passthru (12.89 KB, patch)
2015-07-11 04:22 UTC, fullermd
no flags Details | Diff
Patch to swapon for fstab auto-ELI (1.55 KB, patch)
2015-07-11 04:23 UTC, fullermd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fullermd 2015-03-24 02:18:19 UTC
Created attachment 154746 [details]
Patch to geli to enable passthru

Add a flag -t to init/onetime to enable TRIM passthru, and -[tT] to configure to adjust it on existing providers.  This will cause GELI to transparently pass through BIO_DELETE's to the underlying provider, so space on things like zvol's can be reclaimed, and SSD's can clean up unused sectors.


This includes a fix from Fabian Keil <freebsd-listen@fabiankeil.de> for 'configure' on onetime providers which is not strictly related, but is entangled in the same code, so would cause conflicts if separated out.

Has been discussed on -geom@ (https://lists.freebsd.org/pipermail/freebsd-geom/2015-March/006070.html) and has general approval there.
Comment 1 fullermd 2015-03-27 10:47:48 UTC
Created attachment 154855 [details]
Patch to swapon for fstab auto-ELI

Here's an additional patch on top that allows setting the 'trim' flag on the mount options in fstab, for swapon's automatic .eli creation.
Comment 2 fullermd 2015-05-10 16:57:12 UTC
Created attachment 156615 [details]
Patch to geli to enable passthru

Update to previous patch with a few adjustments to allow unpatched userland to still onetime/configure with patched kernel.
Comment 3 fullermd 2015-07-11 04:22:05 UTC
Created attachment 158599 [details]
Patch to geli to enable passthru

Updated patch which inverts the sense of the flag from FLAG_DELETE to FLAG_NODELETE, leaving the unflagged (and default) case to enable TRIM.
Comment 4 fullermd 2015-07-11 04:23:04 UTC
Created attachment 158601 [details]
Patch to swapon for fstab auto-ELI

Updated to use 'notrim' flag match new geli patch.
Comment 5 fullermd 2015-07-11 04:29:15 UTC
Comment on attachment 154855 [details]
Patch to swapon for fstab auto-ELI

Superceded
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-08-08 09:51:54 UTC
A commit references this bug:

Author: pjd
Date: Sat Aug  8 09:51:41 UTC 2015
New revision: 286444
URL: https://svnweb.freebsd.org/changeset/base/286444

Log:
  Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when
  GELI is used on a SSD or inside virtual machine, so that guest can tell
  host that it is no longer using some of the storage.

  Enabling BIO_DELETE passthru comes with a small security consequence - an
  attacker can tell how much space is being really used on encrypted device and
  has less data no analyse then. This is why the -T option can be given to the
  init subcommand to turn off this behaviour and -t/T options for the configure
  subcommand can be used to adjust this setting later.

  PR:		198863
  Submitted by:	Matthew D. Fuller fullermd at over-yonder dot net

  This commit also includes a fix from Fabian Keil freebsd-listen at
  fabiankeil.de for 'configure' on onetime providers which is not strictly
  related, but is entangled in the same code, so would cause conflicts if
  separated out.

Changes:
  head/sbin/geom/class/eli/geli.8
  head/sbin/geom/class/eli/geom_eli.c
  head/sys/geom/eli/g_eli.c
  head/sys/geom/eli/g_eli.h
  head/sys/geom/eli/g_eli_ctl.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-08-08 09:57:56 UTC
A commit references this bug:

Author: pjd
Date: Sat Aug  8 09:57:40 UTC 2015
New revision: 286445
URL: https://svnweb.freebsd.org/changeset/base/286445

Log:
  Allow to disable BIO_DELETE passthru in fstab for swap-on-geli devices by
  passing 'notrim' option.

  PR:		198863
  Submitted by:	Matthew D. Fuller fullermd at over-yonder dot net

Changes:
  head/sbin/swapon/swapon.c
  head/share/man/man5/fstab.5
Comment 8 Nick Wolff 2016-04-30 20:40:20 UTC
Are there plans to mfc this to stable10?
Comment 9 Ciaby 2016-06-17 16:23:09 UTC
Would be nice to have it in 10.3... :)
Comment 10 vali gholami 2017-12-17 07:12:30 UTC
MARKED AS SPAM
Comment 11 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:54:12 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 12 Kyle Evans freebsd_committer freebsd_triage 2018-08-09 02:25:43 UTC
I think at this point it's safe to say this likely won't be MFC'd to stable/10, which goes EoL in the next few months. It is, however, in 11.1 and 11.2.
Comment 13 Andriy Gapon freebsd_committer freebsd_triage 2019-11-30 16:09:41 UTC
*** Bug 182713 has been marked as a duplicate of this bug. ***