From owner-svn-src-head@freebsd.org Wed Nov 7 16:50:59 2018 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 B4EC2112A226 for ; Wed, 7 Nov 2018 16:50:59 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 280F2703BD for ; Wed, 7 Nov 2018 16:50:59 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-oi1-f196.google.com with SMTP id v198-v6so14404604oif.2 for ; Wed, 07 Nov 2018 08:50:59 -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:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RmwxnyCBLP9hCrO6MmRs7ov0Vc2oHwTtXGE8uVr75gU=; b=fRKcb5Z1BpzaxCbPSIpLyXqzgTAJQQjgkTgMBZYMqRmnULfcfjMd4nkT+ozBHtnc9U ya+ApA7YhxjIraOMpwWm8hrmgXDTbU3LE54KcRaBN/bMi8kJb7JGOti1HIpMvrpcZegl fCgzp8oYLppnNyHrvkGGm38X6Z3rls0tfJtXwBhQa0txMM3p0qkxdopQU5p3Gwq9GhyP HhLsIpusPtHy/fXHGS48yWqbKzjRh/1sIm5MYjFUtHmwcER/UYlIAL7NUbAqH4+nuClW SQ2WcBR8OiMa1VQogRPJzsWd5/DQWT2wWjjoSYz8wYlWpc8LRUj/yPnvwkCPuIrIyLye XdsA== X-Gm-Message-State: AGRZ1gIykxJdJG8B2XpdiakJYmE+prUyrzSc6t0eOsYo19XL/yCDQyfS IReQn5LWDh2KKZaZBTUvmKoB2TpTVq6P/sFfUbkiFQ== X-Google-Smtp-Source: AJdET5e5xgomQG78vL5+WpW8wR95UGmIo1PL4Ae7C47CAInjgp7pzce9+t9wNcI2AZVZw0idydSwO3OIuoX4AQYPhQY= X-Received: by 2002:aca:e343:: with SMTP id a64-v6mr507514oih.79.1541609138453; Wed, 07 Nov 2018 08:45:38 -0800 (PST) MIME-Version: 1.0 References: <1541606248.52306.42.camel@freebsd.org> <201811071606.wA7G6mQW001639@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201811071606.wA7G6mQW001639@pdx.rh.CN85.dnsmgr.net> From: Maxim Sobolev Date: Wed, 7 Nov 2018 08:45:27 -0800 Message-ID: Subject: Re: svn commit: r340187 - head/sys/geom To: rgrimes@freebsd.org Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Pawel Jakub Dawidek X-Rspamd-Queue-Id: 280F2703BD X-Spamd-Result: default: False [-4.02 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; RCVD_IN_DNSWL_NONE(0.00)[196.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.03)[ipnet: 209.85.128.0/17(-3.62), asn: 15169(-1.45), country: US(-0.09)]; FORGED_SENDER(0.30)[sobomax@freebsd.org,sobomax@sippysoft.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[196.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[sobomax@freebsd.org,sobomax@sippysoft.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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, 07 Nov 2018 16:50:59 -0000 Reverted, sorry. Turns out that i/o into last_sector+1 is handled differently. I'll probably have to use different strategy to properly fail out-of-bound ioctl(DIOCGDELETE) or otherwise indicate its result to the userland app. To my defense, this patch has been out for 3 weeks on freebsd-geom, and I got 0 responses. -Max On Wed, Nov 7, 2018 at 8:06 AM Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Tue, 2018-11-06 at 16:17 -0800, Rodney W. Grimes wrote: > > > > > > > > Rodney, this was actually my original intention, however then I > noticed in > > > > the GEOM code there is at least one case when BIO_FLUSH request is > being > > > > generated internally with bio_offset == mediasize and bio_lenth == > 0, so I > > > > thought there might be some need to allow such requests through. But > I'd > > > > happily go with the stricter rule if it does no harm. I simply don't > know > > > > enough about the intended use and the logic behind zero-length > transfers to > > > > make that call. > > > I am not sure enough on if mediasize is 0 based or not, > > > if it is then the error case should be fixed, and the > > > code you show below should also be fixed as it is > > > technically making a request beyond the end of device. > > > > > > I am also murky on why we are even doing a 0 size > > > operation and end of device, is that to validate > > > we can access all the media???If so then this wrong > > > code and wrong error return should be fixed as it > > > is off by 1. > > > > > > > > > > > > > > > -Max > > > > > > > > int > > > > g_io_flush(struct g_consumer *cp) > > > > { > > > > ... > > > > ????????bp = g_alloc_bio(); > > > > ????????bp->bio_cmd = BIO_FLUSH; > > > > ... > > > > ????????bp->bio_offset = cp->provider->mediasize; > > > The above should have a - 1 on it. > > > > > > > Unless offset > mediasize is specifically a signal to downstream code > > in some way about how the flush is to be performed. > > Could very well be, should be documented some place though. > > > Nearly identical code to create a BIO_FLUSH bio appears in ufs softdeps > > and in zfs. Before starting to arbitrarily change code that has worked > > since 2006, it might be a good idea to track down why these values are > > set the way they are. Unfortunately, there is no clue in the commit > > logs, but maybe the author (pjd@, cc'd) can englighten us. > > I agree with that take on the situation, and it is why I asked > for a revert and investigation, rather than trying to solve > why we suddenly fail some regression tests. > > -- > Rod Grimes > rgrimes@freebsd.org > >