Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2016 12:31:56 +0200 (CEST)
From:      =?ISO-8859-1?Q?Trond_Endrest=F8l?= <Trond.Endrestol@fagskolen.gjovik.no>
To:        Julian Elischer <julian@freebsd.org>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@FreeBSD.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: zfs crash on FreeBSD 10.3
Message-ID:  <alpine.BSF.2.20.1610141230430.45618@mail.fig.ol.no>
In-Reply-To: <55fa7ab0-2a65-6a3c-4b19-49c2588b5911@freebsd.org>
References:  <55fa7ab0-2a65-6a3c-4b19-49c2588b5911@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 14 Oct 2016 00:19-0700, Julian Elischer wrote:

> I attempted to add a second partition to an existing FS pool in FreeBSD 10.3
> and the result was a crash..
> 
> is there anyone out there with a scratch system (10.3) (or two spare drives)
> who can show me this working?
> 
> Does it look familiar to anyone?
> 
> The drive 'boot0' is being used as the root drive, but we are in single user
> mode, so its' read-only at this stage.
> 
> =============== cut-n-paste =============
> 
> [boot -s]
> 
> [...]
> 
> Trying to mount root from zfs:p8/image1 []...
> Enter full pathname of shell or RETURN for /bin/sh:
> PS1="# "
> #
> #
> # ls /dev/gpt
> boot0    boot1

> # zpool attach -f p8 gpt/boot0 gpt/boot1

Do you really need to force zpool to attach the second partition?
What happens if you omit the -f flag?

> Fatal trap 12: page fault while in kernel mode
> cpuid = 1; apic id = 01
> fault virtual address    = 0x50
> fault code        = supervisor read data, page not present
> instruction pointer    = 0x20:0xffffffff81717063
> stack pointer            = 0x28:0xfffffe0169bfc640
> frame pointer            = 0x28:0xfffffe0169bfc9a0
> code segment        = base 0x0, limit 0xfffff, type 0x1b
>             = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags    = interrupt enabled, resume, IOPL = 0
> current process        = 3 (txg_thread_enter)
> trap number        = 12
> Panic:Thought about setting the watchdog to 10 Minutes
> panic: page fault
> cpuid = 1
> 
> KDB: stack backtrace:
>  stack1 db_trace_self_wrapper+0x2a
>  kdb_backtrace+0x37 vpanic+0xf7
>  panic+0x67 trap_fatal+0x264
>  trap_pfault+0x1c2
>  trap+0x38c
>  calltrap+0x8
>  dsl_scan_sync+0x2f3
>  spa_sync+0x328
>  txg_sync_thread+0x140
>  fork_exit+0x135
>  fork_trampoline+0xe
> 
> KDB: enter: panic
> [ thread pid 3 tid 100328 ]
> Stopped at      kdb_enter+0x50: movq    $0,0x6bd5cd(%rip)
> db> reboot
> 
> I will add that after this, every boot hits this problem. (same stack trace).
> the box is effectively bricked
> (or would be if it weren't just a bhyve image)

-- 
+-------------------------------+------------------------------------+
| Vennlig hilsen,               | Best regards,                      |
| Trond Endrestøl,              | Trond Endrestøl,                   |
| IT-ansvarlig,                 | System administrator,              |
| Fagskolen Innlandet,          | Gjøvik Technical College, Norway,  |
| tlf. mob.   952 62 567,       | Cellular...: +47 952 62 567,       |
| sentralbord 61 14 54 00.      | Switchboard: +47 61 14 54 00.      |
+-------------------------------+------------------------------------+
From owner-freebsd-current@freebsd.org  Fri Oct 14 12:04:02 2016
Return-Path: <owner-freebsd-current@freebsd.org>
Delivered-To: freebsd-current@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA3B4C106A7
 for <freebsd-current@mailman.ysv.freebsd.org>;
 Fri, 14 Oct 2016 12:04:02 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (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 34E70D98
 for <freebsd-current@freebsd.org>; Fri, 14 Oct 2016 12:04:01 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9EC3Y8l060616
 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO);
 Fri, 14 Oct 2016 15:03:34 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9EC3Y8l060616
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id u9EC3XKR060609;
 Fri, 14 Oct 2016 15:03:34 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Fri, 14 Oct 2016 15:03:33 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Hartmut.Brandt@dlr.de
Cc: scott.k.mitch1@gmail.com, freebsd-current@freebsd.org, sepherosa@gmail.com,
 adrian.chadd@gmail.com
Subject: Re: asio and kqueue (2nd trye) (was: RE: (boost::)asio and kqueue
 problem)
Message-ID: <20161014120333.GB2404@kib.kiev.ua>
References: <611243783F62AF48AFB07BC25FA4B1061CE64959@DLREXMBX01.intra.dlr.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <611243783F62AF48AFB07BC25FA4B1061CE64959@DLREXMBX01.intra.dlr.de>
User-Agent: Mutt/1.7.0 (2016-08-17)
X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no
 autolearn_force=no version=3.4.1
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
 <freebsd-current.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-current>, 
 <mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current/>;
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
 <mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 14 Oct 2016 12:04:02 -0000

On Fri, Oct 14, 2016 at 09:21:52AM +0000, Hartmut.Brandt@dlr.de wrote:
> Hi all,
> 
> here is the 2nd try taking into account the comments I received. Since I'm not familiar with the locking in the sockets area I ask somebody with that knowledge to check it before I commit it.

I have only style notes, the factual code changes in the patch look good
to me.

Index: uipc_socket.c
===================================================================
--- uipc_socket.c	(revision 307091)
+++ uipc_socket.c	(working copy)
@@ -159,15 +159,9 @@
 static int	filt_soread(struct knote *kn, long hint);
 static void	filt_sowdetach(struct knote *kn);
 static int	filt_sowrite(struct knote *kn, long hint);
-static int	filt_solisten(struct knote *kn, long hint);
 static int inline hhook_run_socket(struct socket *so, void *hctx, int32_t h_id);
 fo_kqfilter_t	soo_kqfilter;
 
-static struct filterops solisten_filtops = {
-	.f_isfd = 1,
-	.f_detach = filt_sordetach,
-	.f_event = filt_solisten,
-};
 static struct filterops soread_filtops = {
 	.f_isfd = 1,
 	.f_detach = filt_sordetach,
@@ -3075,10 +3069,7 @@
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		if (so->so_options & SO_ACCEPTCONN)
-			kn->kn_fop = &solisten_filtops;
-		else
-			kn->kn_fop = &soread_filtops;
+		kn->kn_fop = &soread_filtops;
 		sb = &so->so_rcv;
 		break;
 	case EVFILT_WRITE:
@@ -3282,29 +3273,34 @@
 static int
 filt_soread(struct knote *kn, long hint)
 {
-	struct socket *so;
+	struct socket *so = kn->kn_fp->f_data;
Style is against mixing declaration and initialization.  Please keep the
next removed line instead.
 
-	so = kn->kn_fp->f_data;
This one.

-	SOCKBUF_LOCK_ASSERT(&so->so_rcv);
+	if (so->so_options & SO_ACCEPTCONN) {
+		kn->kn_data = so->so_qlen;
+		return (!TAILQ_EMPTY(&so->so_comp));
 
-	kn->kn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl;
-	if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
-		kn->kn_flags |= EV_EOF;
-		kn->kn_fflags = so->so_error;
-		return (1);
-	} else if (so->so_error)	/* temporary udp error */
-		return (1);
+	} else {
You do not need else {} block, 'then' branch ends with return(). If you
remove else, you do not need additional indent for the old filt_soread()
function' body.

+		SOCKBUF_LOCK_ASSERT(&so->so_rcv);
 
-	if (kn->kn_sfflags & NOTE_LOWAT) {
-		if (kn->kn_data >= kn->kn_sdata)
-			return 1;
-	} else {
-		if (sbavail(&so->so_rcv) >= so->so_rcv.sb_lowat)
-			return 1;
+		kn->kn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl;
+		if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
+			kn->kn_flags |= EV_EOF;
+			kn->kn_fflags = so->so_error;
+			return (1);
+		} else if (so->so_error)	/* temporary udp error */
+			return (1);
+
+		if (kn->kn_sfflags & NOTE_LOWAT) {
+			if (kn->kn_data >= kn->kn_sdata)
+				return 1;
return (1);
since you change the line anyway.

+		} else {
+			if (sbavail(&so->so_rcv) >= so->so_rcv.sb_lowat)
+				return 1;
Same.

+		}
+
+		/* This hook returning non-zero indicates an event, not error */
+		return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD));
 	}
-
-	/* This hook returning non-zero indicates an event, not error */
-	return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD));
 }
 
 static void
@@ -3346,16 +3342,6 @@
 		return (kn->kn_data >= so->so_snd.sb_lowat);
 }
 
-/*ARGSUSED*/
-static int
-filt_solisten(struct knote *kn, long hint)
-{
-	struct socket *so = kn->kn_fp->f_data;
-
-	kn->kn_data = so->so_qlen;
-	return (!TAILQ_EMPTY(&so->so_comp));
-}
-
 int
 socheckuid(struct socket *so, uid_t uid)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1610141230430.45618>