From owner-svn-src-head@freebsd.org Sun Nov 5 18:42:53 2017 Return-Path: Delivered-To: svn-src-head@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 09FE4E4DC68 for ; Sun, 5 Nov 2017 18:42:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (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 C001164F17 for ; Sun, 5 Nov 2017 18:42:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x244.google.com with SMTP id 134so13544378ioo.0 for ; Sun, 05 Nov 2017 10:42:52 -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=ur5GzTGAL6KTtw6Exuyq18ie+LbU8p0+jEbbLbpGlVQ=; b=O+7XbSAV2YygDrxZ3UvE5/lo90pfHp0+uGUvTjMuLi5Q3CT8SN0wgO4oMKqXSFei0l TSRRbOXmce7Ki9F1w+we9Uw0NgJJHpHMEE5bdx4Ke60qhrK7JkZGSecZkiRYt1sl6RDR D8EQ/du6bdxT5qBbT5PNzDfzANi4AT0tKBfHB9/sp5YA9LDoJLxM5c/ua4/x8XISNzbh xgylS/ZDm8ICF3uLJ8P3PErPZhI1/VzhO22Lo2Av+7zTUJn5+zcRr0Ty5otGFXWyNOQO JD4XhjV/BYK74TnnrR5SJe1C4dGpUp5MVfbw+6z3tIgMbfpxzDjMZIi2lHJben8plyxq NnQg== 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=ur5GzTGAL6KTtw6Exuyq18ie+LbU8p0+jEbbLbpGlVQ=; b=A0KXxLeUogF7QdvXGDiG10sM2uhPsUhlFnqEWI7cI+R0mz3TgDdch86P4hNzLT6gz6 Fan9gDJYE+TFYpDtcTj/gfJEsLf5N4nP9au5yWpUnhHrTVg13P1P2cjIpsgn+JIQ5oj0 OqC8CMSH6dxP2mGEsGQlIEwUktdoYgrz0Exs3c22/5uXHcGRDMfPI0AMqPOXehYU7mc0 hixk5wxu8I2vY7doDHryXFO6k/g8jxyGo3LtocpsHanBGetgg9cCOV8ZdaxT3lkLjrGn fqYhNbnYu2I0FFbZ9zg+EuMdkjcZdrESIZPC+rkHkJvbAj+5Mp6Xido22d9hEQr9ONSU AH/w== X-Gm-Message-State: AJaThX4/3D9DlrOG0MOW2kzZnakRGb5g5JjcZwMuiWrD4SSLwWnp4tcY 0ND+5f1EL42WlH2vLd4XMlW9ioU0Br8uECPK9ywfsw== X-Google-Smtp-Source: ABhQp+RCQvfa6Lat+a2lZJYklW6L2YzR7ymZ2EoWe+JD/mFCr59tXfurHjr15zg0GlmwXKoE8GPEuH3CYU8ko7xQRT4= X-Received: by 10.107.81.21 with SMTP id f21mr16448250iob.63.1509907372180; Sun, 05 Nov 2017 10:42:52 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Sun, 5 Nov 2017 10:42:51 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:c96d:b7be:45de:c872] In-Reply-To: References: <201711041049.vA4AnZUE096709@repo.freebsd.org> <20171105130607.GA2566@kib.kiev.ua> <20171105173032.GE2566@kib.kiev.ua> From: Warner Losh Date: Sun, 5 Nov 2017 11:42:51 -0700 X-Google-Sender-Auth: WKMHCvVH08c6pAKLqijTu87t37w Message-ID: Subject: Re: svn commit: r325386 - head/sys/kern To: "Conrad E. Meyer" Cc: Konstantin Belousov , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 18:42:53 -0000 On Sun, Nov 5, 2017 at 11:32 AM, Conrad Meyer wrote: > E.g., > > --- a/sys/ufs/ffs/ffs_alloc.c > +++ b/sys/ufs/ffs/ffs_alloc.c > @@ -304,8 +304,7 @@ retry: > } > > if (bp->b_blkno == bp->b_lblkno) { > - if (lbprev >= UFS_NDADDR) > - panic("ffs_realloccg: lbprev out of range"); > + ASSERT(lbprev < UFS_NDADDR, "ffs_realloccg: lbprev out > of range"); > bp->b_blkno = fsbtodb(fs, bprev); > } > Just a side point: All these should be programming errors. The bogus data that comes or could come from the FS itself should remain always-on panics. Well, actually, they should transition from always-on panics to some sort of degraded mount that would be more resilient in the face of such corruption. But failing that, they should remain always-on panics :) Warner > On Sun, Nov 5, 2017 at 9:30 AM, Konstantin Belousov > wrote: > > On Sun, Nov 05, 2017 at 09:16:28AM -0800, Conrad Meyer wrote: > >> On Sun, Nov 5, 2017 at 5:06 AM, Konstantin Belousov < > kostikbel@gmail.com> wrote: > >> > On Sat, Nov 04, 2017 at 12:04:56PM -0700, Conrad Meyer wrote: > >> >> This is a functional change, because MPASS (via KASSERT) is only > >> >> enabled on DEBUG kernels. Ideally we would have a kind of ASSERT > that > >> >> worked on NODEBUG kernels. > >> > Why would we need such thing ? > >> > > >> > Our conventions are clear: consistency checks are normally done with > >> > KASSERT() and enabled for DEBUG (INVARIANTS or harder) configurations. > >> > We only leave explicit panics in the production kernels when there > >> > continuation of operations is worse then abort, e.g. when UFS detects > >> > the metadata corruption. > >> > >> An always-on assert construct would be precisely for the latter > >> scenario. Instead, we litter the tree with "if (!invariant) { > >> panic(); }." > > We do > > > > #ifdef INVARIANTS > > if (!condition) panic(); > > #endif > > > > I do not understand what do you mean by 'instead'. > >