From owner-svn-src-head@freebsd.org Wed May 29 20:34:36 2019 Return-Path: Delivered-To: svn-src-head@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 237FC15AC900; Wed, 29 May 2019 20:34:36 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6CDC85CA9; Wed, 29 May 2019 20:34:35 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8656A6EE0; Wed, 29 May 2019 20:34:35 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4TKYZGm034793; Wed, 29 May 2019 20:34:35 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4TKYZMn034792; Wed, 29 May 2019 20:34:35 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201905292034.x4TKYZMn034792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 29 May 2019 20:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348370 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 348370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B6CDC85CA9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Wed, 29 May 2019 20:34:36 -0000 Author: allanjude Date: Wed May 29 20:34:35 2019 New Revision: 348370 URL: https://svnweb.freebsd.org/changeset/base/348370 Log: Fix assertion in ZFS TRIM code Due to an attempt to check two conditions at once in a macro not designed as such, the assertion would always evaluate to true. #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ const TYPE __left = (TYPE)(LEFT); \ const TYPE __right = (TYPE)(RIGHT); \ if (!(__left OP __right)) \ assfail3(#LEFT " " #OP " " #RIGHT, \ (uintmax_t)__left, #OP, (uintmax_t)__right, \ __FILE__, __LINE__); \ _NOTE(CONSTCOND) } while (0) #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) Mean that we compared: left = (type == ZIO_TYPE_FREE || psize) OP = "<=" right = (SPA_MAXBLOCKSIZE) If the type was not FREE, 0 is less than SPA_MAXBLOCKSIZE (16MB) If the type is ZIO_TYPE_FREE, 1 is less than SPA_MAXBLOCKSIZE The constraint on psize (physical size of the FREE operation) is never checked against SPA_MAXBLOCKSIZE Reported by: Ka Ho Ng Reviewed by: kevans MFC after: 2 weeks Sponsored by: Klara Systems Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed May 29 19:11:09 2019 (r348369) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed May 29 20:34:35 2019 (r348370) @@ -643,7 +643,7 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const { zio_t *zio; - ASSERT3U(type == ZIO_TYPE_FREE || psize, <=, SPA_MAXBLOCKSIZE); + IMPLY(type != ZIO_TYPE_FREE, psize <= SPA_MAXBLOCKSIZE); ASSERT(P2PHASE(psize, SPA_MINBLOCKSIZE) == 0); ASSERT(P2PHASE(offset, SPA_MINBLOCKSIZE) == 0);