From owner-freebsd-hackers@freebsd.org Fri Apr 12 15:11:18 2019 Return-Path: Delivered-To: freebsd-hackers@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 4C9A7157EEFB for ; Fri, 12 Apr 2019 15:11:18 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45C9C772F8 for ; Fri, 12 Apr 2019 15:11:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f182.google.com with SMTP id t4so672317ljc.2 for ; Fri, 12 Apr 2019 08:11:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=zl0qJIFJh7II464PytAfF0rjS6O2DdURCheZnoZqbBs=; b=kvhJhOHuVNOfOs+KnaB/ONe/dLo0gj9B1M313nbDEM3+5aTx/gV7BQmO6jvCyGLy4D YQ9ZtgRPrR42EueNdGk0MxlfI8YdOEeJ+x7XwISMICU43jTMZ0tXzkntJdkVrzonmw8W zbufCF4PisgDlzi5J2UAAXj+n1PYxK6v2E36U/SWtwJKIxLlrUUvHnLEJCc+HOi5DS18 pCA6qn8saiiHhZNp9Bh6/6R7PW81Mv5e+Um+16P4deSQYzpUbjxLtpsSWZDMiUqqF2G+ KTCOmKnmdI+cqAfnq9NEBV6TwCArmK+jSsAXgRbSqoQewzdtVwmNbPBM8jSXz3kU6ljN DpTg== X-Gm-Message-State: APjAAAWBy3wXocTlfJNV7LpxCkUE//rRWKy88l+aB3GcUQKl++zLkXyf fQeK9x2jB/HG6GFHWeMcy2QOalY89pRfNXIIRGXIrs6x2Wo= X-Google-Smtp-Source: APXvYqyZb2KL0s4pdqWLsFt03QMtUjelwpgQLC4FUpitH3LBZgf0wZOfLkrPiL7N3DxJXLUH6ykoLQTsheMEzwIh1+c= X-Received: by 2002:a2e:5bcc:: with SMTP id m73mr22363540lje.100.1555081869802; Fri, 12 Apr 2019 08:11:09 -0700 (PDT) MIME-Version: 1.0 From: Alan Somers Date: Fri, 12 Apr 2019 09:10:58 -0600 Message-ID: Subject: When can a struct buf's b_lblkno field by < 0 ? To: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 45C9C772F8 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.208.182 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.19 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_TRACE(0.00)[0:+]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.85)[-0.851,0]; RCVD_IN_DNSWL_NONE(0.00)[182.208.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.34)[ip: (-0.57), ipnet: 209.85.128.0/17(-3.87), asn: 15169(-2.18), country: US(-0.06)]; RCVD_TLS_LAST(0.00)[]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; SUBJECT_ENDS_QUESTION(1.00)[]; TO_DOM_EQ_FROM_DOM(0.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2019 15:11:18 -0000 In struct buf, b_lblkno is documented as "Logical block number". I would expect that to always be nonnegative. However, vtruncbuf loops through a list of buffers, skipping those where "bp->b_lblkno > 0". Maybe that's just an awkward way of writing "do something for the buffer where b_lblkno == 0", but SVN archaeology suggests otherwise. Before r112182, the code looked like this, implying that the b_lblkno could actually be negative: if ((bp->b_flags & B_DELWRI) && (bp->b_lblkno < 0)) { Does anybody know under what circumstances that field might be negative? Also, was r112182 a correct change? It appears to have negated "<" and gotten ">", neglecting the "==" case. https://svnweb.freebsd.org/base/head/sys/kern/vfs_subr.c?r1=112182&r2=112181&pathrev=112182 -Alan