From owner-freebsd-current@freebsd.org Sat Feb 17 14:47:16 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DF0AF14ABF for ; Sat, 17 Feb 2018 14:47:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (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 A6C8B825D3 for ; Sat, 17 Feb 2018 14:47:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id t126so7037572iof.4 for ; Sat, 17 Feb 2018 06:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/WPCRZotgTSrXYNYyNuT2Y05htFSDzrMnqpa2sUJBTA=; b=GBBADpRadizGYK6gfGjE0TRzYPMvg4n6c77Qi5cnA25i2P4OVIznaOJCVfJEzSk9ll R4q+P031JFj1ifKpyCQWJBB/zhlNoikJcFiY+K8ym2ddJ6GYnjqtcNB4xxUZbw0yR71z lmlUxZK7naStvuwLG7vZYHszTShtroWvBCxTaK3dKLisRhWRUOFVhbQwJ284kwZ/2RP6 TTHVYoGuADiqzHxVjGkB60/O68pck5Xi7gyOhTUoSZtb5rr+T1KZDBhbyZEyaplGs6jM VTmKyn9bPSGiY+1VH8WD/5+ZZtPtB3MxjhRnFYfzjeEKfoNdJI3oSnEv+eEM+3lsC+jf rvKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/WPCRZotgTSrXYNYyNuT2Y05htFSDzrMnqpa2sUJBTA=; b=AfJPf8JkdQS0W8mhqVNyYUQFKMDgcqvI3bBYuYsFjA+zSrnehD957bXLgV9zsffRBm lny1FdHH5ou3P0afRSMzOkZZvcYy7kJxAlOKmmh63EGR08ff/bDT44AplPeM1QUauj/u gwe+Socggc5F+MalUaup1IVQH1q0HuC+v0ggfjHmKHcOKyer7RFPKggL5uBt+xIyfpAF 8vZujVuIeyor6ZxbFVOlmMxG/JKQCe5PREnNWnXB3ln1qw3txRJG8R2IvUDDMG1t8w0k oT/D8WfPy9pIn50MLsKeyEU9nDNxPoPQW5a637VSynRo3IOwha9UM+jWVYoAbLrWOVSN XtDA== X-Gm-Message-State: APf1xPDvocW3mUYGHaEni96Oz9sCKawK/S7D6SgmbIxxR8TRqNT1dIyk 1rteG3/l1zwN8bVWUXMRjz+C9S7M32l9fDO2XZnXAQ== X-Google-Smtp-Source: AH8x225KEMmB6w1lJhGynYW0EqpYbM5c2lvacojB/lfKft94P0ddVLjNkh4CrnyZAUMsAf93dFi7kABYUDsT7+hqqZ0= X-Received: by 10.107.2.6 with SMTP id 6mr12593625ioc.117.1518878834877; Sat, 17 Feb 2018 06:47:14 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sat, 17 Feb 2018 06:47:14 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: From: Warner Losh Date: Sat, 17 Feb 2018 07:47:14 -0700 X-Google-Sender-Auth: PgwR9KUXoLlmmx6oullJHxTmMOA Message-ID: Subject: Re: panic in daprobedone: Unholding 4 with cnt = 0 To: Hans Petter Selasky Cc: Warner Losh , FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 14:47:16 -0000 That's interesting. What did you do to get there? There's some code path that's unholding the periph without first holding it. I've been trying to find a scenario. Warner On Sat, Feb 17, 2018 at 5:01 AM, Hans Petter Selasky wrote: > I've started to hit this panic with USB mass storage, before even the > device has become in-use: > > panic: Unholding 4 with cnt = 0 > > Backtrace: > > vpanic() > panic() > daprobedone() > dadone() > xpt_done_process() > xpt_done_td() > fork_exit() > fork_trampoline() > > db> > > > static inline void >> da_periph_unhold(struct cam_periph *periph, da_ref_token token) >> { >> int cnt; >> struct da_softc *softc = periph->softc; >> >> token_sanity(token); >> DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", >> da_ref_text[token], token); >> cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); >> if (cnt != 1) >> panic("Unholding %d with cnt = %d", token, cnt); >> cam_periph_unhold(periph); >> } >> >