From owner-freebsd-geom@FreeBSD.ORG Sun Jun 14 18:51:10 2015 Return-Path: Delivered-To: freebsd-geom@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1C669B7 for ; Sun, 14 Jun 2015 18:51:10 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 699FE9E1 for ; Sun, 14 Jun 2015 18:51:10 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: by wgzl5 with SMTP id l5so28951324wgz.3 for ; Sun, 14 Jun 2015 11:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=pZiWHisMYkvIBV0aLH3DwVsPyph64aflBxi+Hk2AtCo=; b=0p5otm3bK6QY+CnhJZCALI8i/dIXej7kdK2QjNhPARN9zouYJ8tv3h056DJKg7cb+L GfmT9hSiaXxMzDXvh0B0jkHixmx5ObtzDwGZ1vFXOsUE8+KLER/nBMPYKWWDtPlLNtIb zsvSKt5fiCN9uTuf7kHSGlYLMSjF0Z7c4S71K3t8aXH/BvVBefApuKjxWwD+MI60L3YV jkCSP50szlae6dQjAFXAPn9MDAQ/4p8jBjNYhGZjqClWr/laOG7Ap6ZGCYKYjuyqsA7i l5bc2iA9qrHIbsY0ePk0QkYiJ/OJX99pOY/HFdD07BT/HdiA1DMn833d8IbA4pjcZqOd KO6Q== MIME-Version: 1.0 X-Received: by 10.180.109.136 with SMTP id hs8mr24726094wib.73.1434307868795; Sun, 14 Jun 2015 11:51:08 -0700 (PDT) Received: by 10.194.74.167 with HTTP; Sun, 14 Jun 2015 11:51:08 -0700 (PDT) In-Reply-To: <20150613224602.GB1733@over-yonder.net> References: <20150613224602.GB1733@over-yonder.net> Date: Sun, 14 Jun 2015 20:51:08 +0200 Message-ID: Subject: Re: geli panics my system after suspend-resume: g_eli_orphan_spoil_assert() called for cd0.eli From: =?UTF-8?B?Sm9zw6kgR2FyY8OtYSBKdWFuaW5v?= To: "Matthew D. Fuller" Cc: freebsd-geom@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 18:51:11 -0000 On 14 June 2015 at 00:46, Matthew D. Fuller wrot= e: > On Sat, Jun 13, 2015 at 04:10:38PM +0200 I heard the voice of > Jos=C3=A9 Garc=C3=ADa Juanino, and lo! it spake thus: >> Hi FreeBSD current, >> >> I get a reproducible panic following these steps: >> >> 1- Mount a geli encrypted DVD: > > This is presumably what's hooked up in g_eli_create(): > > /* > * Spoiling cannot happen actually, because we keep provider open for > * writing all the time or provider is read-only. > */ > gp->spoiled =3D g_eli_orphan_spoil_assert; > > > The backtrace makes me think that coming out of resume will cause a > media change event on the cd0 device, which sounds a _little_ odd, but > may be necessary due to Stupid Reality Crap. That pushes a spoil > event down to g_eli. And g_eli seems to assume that can't happen to > a thing it's got around an open. > > > With the caveat that I'm no expert on ELI or GEOM, and any advice I > might give could just be the trigger for a nasal demon invasion of our > world, one thing you might try is taking that event as a hint to just > blow away the .eli device; treat it like an orphan. So changing that > callback to using the g_eli_orphan func instead. e.g., something like > > Index: g_eli.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- g_eli.c (revision 284359) > +++ g_eli.c (working copy) > @@ -730,7 +730,7 @@ g_eli_create(struct gctl_req *req, struct g_class > * Spoiling cannot happen actually, because we keep provider open= for > * writing all the time or provider is read-only. > */ > - gp->spoiled =3D g_eli_orphan_spoil_assert; > + gp->spoiled =3D g_eli_orphan; > gp->orphan =3D g_eli_orphan; > gp->dumpconf =3D g_eli_dumpconf; > /* > Thanks for your response. I have tried your patch and works. At least, the laptop does not panic. But after resume, the geli device is destroyed: Jun 14 20:29:32 abel kernel: GEOM_ELI: Device cd0.eli destroyed. Jun 14 20:29:32 abel kernel: GEOM_ELI: Detached cd0.eli on last close. The /cdrom filesystem remains mounted, but it is unusable. It is needed to remount, attaching again the encrypted DVD. By the other hand, I have not tested if this issue is limited to removable media as CD-ROMs o DVDs. Regards From owner-freebsd-geom@FreeBSD.ORG Mon Jun 15 06:01:37 2015 Return-Path: Delivered-To: freebsd-geom@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB32BEEA for ; Mon, 15 Jun 2015 06:01:37 +0000 (UTC) (envelope-from fullermd@over-yonder.net) Received: from thyme.infocus-llc.com (thyme.infocus-llc.com [199.15.120.10]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 843DC7E2 for ; Mon, 15 Jun 2015 06:01:37 +0000 (UTC) (envelope-from fullermd@over-yonder.net) Received: from draco.over-yonder.net (c-75-65-60-66.hsd1.ms.comcast.net [75.65.60.66]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by thyme.infocus-llc.com (Postfix) with ESMTPSA id C5B9A37B5CF; Mon, 15 Jun 2015 01:01:29 -0500 (CDT) Received: by draco.over-yonder.net (Postfix, from userid 100) id 3m92944m9Hz2Zn; Mon, 15 Jun 2015 01:01:28 -0500 (CDT) Date: Mon, 15 Jun 2015 01:01:28 -0500 From: "Matthew D. Fuller" To: =?iso-8859-1?Q?Jos=E9_Garc=EDa?= Juanino Cc: freebsd-geom@freebsd.org Subject: Re: geli panics my system after suspend-resume: g_eli_orphan_spoil_assert() called for cd0.eli Message-ID: <20150615060128.GC1733@over-yonder.net> References: <20150613224602.GB1733@over-yonder.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Editor: vi X-OS: FreeBSD User-Agent: Mutt/1.5.23-fullermd.4 (2014-03-12) X-Virus-Scanned: clamav-milter 0.98.7 at thyme.infocus-llc.com X-Virus-Status: Clean X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 06:01:37 -0000 On Sun, Jun 14, 2015 at 08:51:08PM +0200 I heard the voice of José García Juanino, and lo! it spake thus: > > I have tried your patch and works. At least, the laptop does not > panic. But after resume, the geli device is destroyed: Yeah, that's presumably unavoidable, once we reach the point where we're getting the media change event. Of course, in your own case, if you can know that is meaningless, you could just replace that callback with a stub that just returns, but that's hardly a good general idea. But presumably geli should treat that spoil event the same as an orpah, which at least avoids the panic and does the least wrong thing in the circumstances. Since the events DO occur (the code suggests the original thought was that they couldn't), we might as well deal with them as gracefully as possible. The only real "solution" in a general sense to the event happening would be to figure out why the CD/DVD device is throwing a media change event on suspend/resume. I have a sneaking suspicion that it's hard to do anything else (you've been suspended, you don't know what's been done to the drive while you weren't around) though... -- Matthew Fuller (MF4839) | fullermd@over-yonder.net Systems/Network Administrator | http://www.over-yonder.net/~fullermd/ On the Internet, nobody can hear you scream.