From owner-svn-src-all@freebsd.org Sat Jan 21 19:51:19 2017 Return-Path: Delivered-To: svn-src-all@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 C6DE7CBBD19; Sat, 21 Jan 2017 19:51:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 706D51797; Sat, 21 Jan 2017 19:51:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v0LJpEgc070262 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 21 Jan 2017 21:51:14 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0LJpEgc070262 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0LJpEdM070261; Sat, 21 Jan 2017 21:51:14 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 21 Jan 2017 21:51:14 +0200 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern Message-ID: <20170121195114.GA2349@kib.kiev.ua> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701211838.v0LIcHIv072626@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2017 19:51:19 -0000 On Sat, Jan 21, 2017 at 06:38:17PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Sat Jan 21 18:38:16 2017 > New Revision: 312600 > URL: https://svnweb.freebsd.org/changeset/base/312600 > > Log: > vfs: refactor _vn_lock > > Stop testing for LK_RETRY and error multiple times. Also postpone the > VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. > > No functional changes. > > Modified: > head/sys/kern/vfs_vnops.c > > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Sat Jan 21 17:39:10 2017 (r312599) > +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017 (r312600) > @@ -1539,27 +1539,24 @@ _vn_lock(struct vnode *vp, int flags, ch > > VNASSERT((flags & LK_TYPE_MASK) != 0, vp, > ("vn_lock called with no locktype.")); > - do { > #ifdef DEBUG_VFS_LOCKS > - KASSERT(vp->v_holdcnt != 0, > - ("vn_lock %p: zero hold count", vp)); > + KASSERT(vp->v_holdcnt != 0, > + ("vn_lock %p: zero hold count", vp)); This line also has wrong inde seems to not be fixed by later commit. > #endif > - error = VOP_LOCK1(vp, flags, file, line); > - flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > - KASSERT((flags & LK_RETRY) == 0 || error == 0, > - ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", > - flags, error)); > - /* > - * Callers specify LK_RETRY if they wish to get dead vnodes. > - * If RETRY is not set, we return ENOENT instead. > - */ > - if (error == 0 && vp->v_iflag & VI_DOOMED && > - (flags & LK_RETRY) == 0) { > +retry: > + error = VOP_LOCK1(vp, flags, file, line); > + flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > + KASSERT((flags & LK_RETRY) == 0 || error == 0, > + ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", > + flags, error)); > + if (flags & LK_RETRY) { Stylish test is if ((flags & LK_RETRY) != 0) { > + if ((error != 0)) Too many (). > + goto retry; > + if ((vp->v_iflag & VI_DOOMED)) { Too many braces again, or missed != 0. > VOP_UNLOCK(vp, 0); > error = ENOENT; > - break; Also, this does the functional change, it seems to completely break LK_RERY logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. > } > - } while (flags & LK_RETRY && error != 0); > + } > return (error); > } >