From owner-svn-src-head@freebsd.org Sun Nov 5 18:32:05 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 3B43BE4D7B7; Sun, 5 Nov 2017 18:32:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f54.google.com (mail-it0-f54.google.com [209.85.214.54]) (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 0ADA26476A; Sun, 5 Nov 2017 18:32:04 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f54.google.com with SMTP id n195so2820608itg.0; Sun, 05 Nov 2017 10:32:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=zgZDDOWoDUU6388w+WVIJqObFsfbKn5MW8fXa2Q9YTs=; b=iBIvpnR0tt8A11oikO94h07DeHmUwfLy3O0xVaZf1oVTfZl0p8HAKcvgXshf9FXlSa ZNgDRY9m4GX4NgQHx+ujJ2r5iBAxHaBChD6WPTeUeGLGIg2QqY8Nn6ZdcGnodIkvJZNA LkQNnW8YU8hMyvcIb/3RIyxzuPA5W4BW+3g7qrkyVJlgDqtEJNSPmnH4iQVGP3SPEg2V SAxdQvhVgcewhYoX6bnTCWOY3mAsnI9iTArOvw5MP5so7U5MSmA8zpqgLC8qq12cOOI2 wuYQJQkGSrzkdPUyhCRQT30HLs/6NA2lHPS0eCAdrKgliZfyyc8ya5WcUCQssnfmRuMg 9qMQ== X-Gm-Message-State: AJaThX4H31PcU+1gEB+QLBqKThuZmGeJkkaeVRQG7oNXLZXdbr4Lm7IH PfPI4rp8mMDgEOV5B8pZ4JqJhp35 X-Google-Smtp-Source: ABhQp+S+fvQuH5R85q0QAzgLdEQ0m85hrP6nwfATCuZwH7B4r71Of9yaeF8MaW4gPX87iUIaC+P/wA== X-Received: by 10.36.105.65 with SMTP id e62mr6550037itc.16.1509906723918; Sun, 05 Nov 2017 10:32:03 -0800 (PST) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id w139sm3579405itb.5.2017.11.05.10.32.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 10:32:03 -0800 (PST) Received: by mail-it0-f45.google.com with SMTP id f187so2822046itb.1; Sun, 05 Nov 2017 10:32:03 -0800 (PST) X-Received: by 10.36.10.82 with SMTP id 79mr6902243itw.128.1509906723463; Sun, 05 Nov 2017 10:32:03 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Sun, 5 Nov 2017 10:32:03 -0800 (PST) In-Reply-To: <20171105173032.GE2566@kib.kiev.ua> References: <201711041049.vA4AnZUE096709@repo.freebsd.org> <20171105130607.GA2566@kib.kiev.ua> <20171105173032.GE2566@kib.kiev.ua> From: Conrad Meyer Date: Sun, 5 Nov 2017 10:32:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r325386 - head/sys/kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" 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:32:05 -0000 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); } 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 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'.