Bug 128299 - [patch] /etc/rc.d/geli does not mount partitions using both journal and eli
Summary: [patch] /etc/rc.d/geli does not mount partitions using both journal and eli
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 7.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-22 20:20 UTC by Martin Beran
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments
file.diff (738 bytes, patch)
2008-10-22 20:20 UTC, Martin Beran
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Beran 2008-10-22 20:20:00 UTC
I have a file system on a device that combines GELI with GJOURNAL. I should be mounted during system startup, but it is not. The corresponding line in /etc/fstab is:
/dev/ad0s2d.journal.eli /mntgeli        ufs     rw,async        1       2
This causes an error in scripts /etc/rc.d/geli and /etc/rc.d/geli2 and the file system is not mounted. The scripts do not handle devices with names containing a dot except the dot in ".eli" suffix. The additional dot is propagated to the value   of variable $provider_, which is later used as a part of another variable name. Also, the scripts would not handle a situation with GELI not being the top layer in a stack of GEOM modules, for example, if the GJOURNAL and GELI were swapped (/dev/ad0s2d.eli.journal).

Fix: The attached patch corrects only the case of GELI over GJOURNAL, not GJOURNAL over GELI.

Patch attached with submission follows:
How-To-Repeat: Add an /etc/fstab line for mounting a file system on a device consisting of a GELI over GJOURNAL or GJOURNAL over GELI and reboot. The file system will not be mounted by the system startup scripts.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-10-23 13:07:33 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 ota 2009-02-17 04:22:43 UTC
Hi, Martin.

I think a patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/120091
fixes your porblem, too.

Do you mind if you try and report it?

Thanks,
Hiro
Comment 3 Martin Beran 2009-02-17 08:50:13 UTC
On Mon, Feb 16, 2009 at 11:22:43PM -0500, Yoshihiro Ota wrote:

Hi, Hiro,

> I think a patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/120091
> fixes your porblem, too.
> 
> Do you mind if you try and report it?

I tried the patch. It solves the second half of the problem - mounting
a DEVICE.eli.journal. But for successful mount of both DEVICE.eli.journal and
DEVICE.journal.eli, I still need my patch for /etc/rc.d/geli and
/etc/rc.d/geli2. Otherwise, I get:

eval: ${geli_ad0s2d....}: Bad substitution

Running "sh -x /etc/rc.d/geli start" reveals the reason of this error:

...
+ geli_expand_entry  /dev/ad0s2d.journal.eli 
+ local devices3
+ local entry dev tail
+ tail=/dev/ad0s2d.journal.eli
+ true
+ dev=/dev/ad0s2d.journal.eli
+ devices3= /dev/ad0s2d.journal.eli
+ tail=
+ break
+ dev=
+ echo /dev/ad0s2d.journal.eli
+ devices=/dev/ad0s2d.journal.eli
+ provider=/dev/ad0s2d.journal
+ provider=ad0s2d.journal
+ devices2= ad0s2d.journal
+ echo ad0s2d.journal
+ devices=ad0s2d.journal
+ [ -z  ]
+ [ -n  ]
+ /sbin/sysctl -n kern.geom.eli.tries
+ geli_tries=3
+ ltr ad0s2d.journal / _
+ local _str _src _dst _out _com
+ _str=ad0s2d.journal
+ _src=/
+ _dst=_
+ _out=
+ IFS=/
+ [ -z  ]
+ _out=ad0s2d.journal
+ echo ad0s2d.journal
+ provider_=ad0s2d.journal
+ eval flags=${geli_ad0s2d.journal_flags}
eval: ${geli_ad0s2d....}: Bad substitution

-- 
Martin Beran
Comment 4 ota 2009-02-26 02:31:03 UTC
I see it now.

I forgot how I tested it but it seems I only tested "geli_expand_entry"
function.  I remember that it extracted multiple occurrences of .eli's in
a single path.

I think I only tested .eli.journal really would get mounted as I didn't
have any devices to test with.


By the way, I don't think DEVICE.journal.eli will be helpful.  Journaing
needs to be fs-aware.  It logs the records of file system updates.
However, if you put GEOM eli on top of it, DEVICE.journal only sees
encripted block and as a result, gournaling is effectively disabled.
In another word, it needs to be the last GEOM layer.

Is that right?

Regards,
Hiro
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:47 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped