From owner-svn-src-head@freebsd.org Fri May 31 17:10:17 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 3C2CA15C1CCC; Fri, 31 May 2019 17:10:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3091074F56; Fri, 31 May 2019 17:10:16 +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 x4VHA8lj022464 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 31 May 2019 20:10:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x4VHA8lj022464 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x4VHA81t022462; Fri, 31 May 2019 20:10:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 31 May 2019 20:10:08 +0300 From: Konstantin Belousov To: Benjamin Kaduk Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r348421 - head/sys/kern Message-ID: <20190531171008.GE27392@kib.kiev.ua> References: <201905301504.x4UF49UT019928@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home 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: Fri, 31 May 2019 17:10:17 -0000 On Thu, May 30, 2019 at 08:14:42PM -0700, Benjamin Kaduk wrote: > On Thu, May 30, 2019 at 8:04 AM Konstantin Belousov wrote: > > > Author: kib > > Date: Thu May 30 15:04:09 2019 > > New Revision: 348421 > > URL: https://svnweb.freebsd.org/changeset/base/348421 > > > > Log: > > Silence witness warning about duplicated mutex type. > > > > The order is correct, it is nullfs vnode interlock -> lower vnode > > interlock. vop_stdadd_writecount() is called from nullfs > > VOP_ADD_WRITECOUNT() and both take interlocks. > > > > Requested by: markj > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > > > Modified: > > head/sys/kern/vfs_default.c > > > > Modified: head/sys/kern/vfs_default.c > > > > ============================================================================== > > --- head/sys/kern/vfs_default.c Thu May 30 14:40:23 2019 (r348420) > > +++ head/sys/kern/vfs_default.c Thu May 30 15:04:09 2019 (r348421) > > @@ -1113,7 +1113,7 @@ vop_stdadd_writecount(struct vop_add_writecount_args > > * > > int error; > > > > vp = ap->a_vp; > > - VI_LOCK(vp); > > + VI_LOCK_FLAGS(vp, MTX_DUPOK); > > if (vp->v_writecount < 0) { > > error = ETXTBSY; > > } else { > > > > > Does this merit a comment justifying the use of DUPOK? This is a common pattern in nullfs, because if upper layer operations is done which requires vnode interlock, it is very common to have the op done on lower layer as well, when you need to take the lower layer vnode interlock. I think it is obvious enough what happens when the flag is used.