From owner-svn-src-all@freebsd.org Fri Feb 9 19:50:48 2018 Return-Path: Delivered-To: svn-src-all@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 59900F1F105; Fri, 9 Feb 2018 19:50:48 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F09875852; Fri, 9 Feb 2018 19:50:48 +0000 (UTC) (envelope-from mckusick@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 0A0911439; Fri, 9 Feb 2018 19:50:48 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w19JolE8041245; Fri, 9 Feb 2018 19:50:47 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w19Joljx041243; Fri, 9 Feb 2018 19:50:47 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802091950.w19Joljx041243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 9 Feb 2018 19:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329078 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 329078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 09 Feb 2018 19:50:48 -0000 Author: mckusick Date: Fri Feb 9 19:50:47 2018 New Revision: 329078 URL: https://svnweb.freebsd.org/changeset/base/329078 Log: Merge biodone_finish() back into biodone(). The primary purpose is to make the order of operations clearer to avoid the race condition that was fixed in r328914. In particular, this commit corrects a similar race that existed in the soft updates callback. Doing some sleuthing through the SVN repository, it appears that bufdone_finish() was added to support XFS: ------------------------------------------------------------------------ r153192 | rodrigc | 2005-12-06 19:39:08 -0800 (Tue, 06 Dec 2005) | 13 lines Changes imported from XFS for FreeBSD project: - add fields to struct buf (needed by XFS) - 3 private fields: b_fsprivate1, b_fsprivate2, b_fsprivate3 - b_pin_count, count of pinned buffer - add new B_MANAGED flag - add breada() function to initiate asynchronous I/O on read-ahead blocks. - add bufdone_finish(), bpin(), bunpin_wait() functions Patches provided by: kan Reviewed by: phk Silence on: arch@ ------------------------------------------------------------------------ It does not appear to ever have been used for anything else. XFS was disconnected in r241607: ------------------------------------------------------------------------ r241607 | attilio | 2012-10-16 03:04:00 -0700 (Tue, 16 Oct 2012) | 5 lines Disconnect non-MPSAFE XFS from the build in preparation for dropping GIANT from VFS. This is not targeted for MFC. ------------------------------------------------------------------------ and removed entirely in r247631: ------------------------------------------------------------------------ r247631 | attilio | 2013-03-02 07:33:54 -0800 (Sat, 02 Mar 2013) | 5 lines Garbage collect XFS bits which are now already completely disconnected from the tree since few months. This is not targeted for MFC. ------------------------------------------------------------------------ Since XFS support is gone, there is no reason to retain biodone_finish(). Suggested by: Warner Losh (imp) Discussed with: cem, kib Tested by: Peter Holm (pho) Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Feb 9 19:46:51 2018 (r329077) +++ head/sys/kern/vfs_bio.c Fri Feb 9 19:50:47 2018 (r329078) @@ -4086,21 +4086,6 @@ bufdone(struct buf *bp) bufobj_wdrop(dropobj); return; } - - bufdone_finish(bp); - - if (dropobj) - bufobj_wdrop(dropobj); -} - -void -bufdone_finish(struct buf *bp) -{ - BUF_ASSERT_HELD(bp); - - if (!LIST_EMPTY(&bp->b_dep)) - buf_complete(bp); - if (bp->b_flags & B_VMIO) { /* * Set B_CACHE if the op was a normal read and no error @@ -4113,14 +4098,14 @@ bufdone_finish(struct buf *bp) bp->b_flags |= B_CACHE; vfs_vmio_iodone(bp); } + if (!LIST_EMPTY(&bp->b_dep)) + buf_complete(bp); if ((bp->b_flags & B_CKHASH) != 0) { KASSERT(bp->b_iocmd == BIO_READ, - ("bufdone_finish: b_iocmd %d not BIO_READ", bp->b_iocmd)); - KASSERT(buf_mapped(bp), - ("bufdone_finish: bp %p not mapped", bp)); + ("bufdone: b_iocmd %d not BIO_READ", bp->b_iocmd)); + KASSERT(buf_mapped(bp), ("bufdone: bp %p not mapped", bp)); (*bp->b_ckhashcalc)(bp); } - /* * For asynchronous completions, release the buffer now. The brelse * will do a wakeup there if necessary - so no need to do a wakeup @@ -4134,6 +4119,8 @@ bufdone_finish(struct buf *bp) bqrelse(bp); } else bdone(bp); + if (dropobj) + bufobj_wdrop(dropobj); } /* Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Fri Feb 9 19:46:51 2018 (r329077) +++ head/sys/sys/buf.h Fri Feb 9 19:50:47 2018 (r329078) @@ -542,7 +542,6 @@ struct buf *geteblk(int, int); int bufwait(struct buf *); int bufwrite(struct buf *); void bufdone(struct buf *); -void bufdone_finish(struct buf *); void bd_speedup(void); int cluster_read(struct vnode *, u_quad_t, daddr_t, long,