From owner-svn-src-head@freebsd.org Mon Mar 16 05:13:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DFEE25A058; Mon, 16 Mar 2020 05:13:39 +0000 (UTC) (envelope-from chuq@chuq.com) Received: from vc.chuq.com (vc.chuq.com [166.84.7.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Chuck Silvers", Issuer "Chuck Silvers" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 48gkwd5z57z4LWm; Mon, 16 Mar 2020 05:13:37 +0000 (UTC) (envelope-from chuq@chuq.com) Received: from spathi.chuq.com (unknown [24.4.24.36]) by vc169.vc.panix.com (Postfix) with ESMTPS id 0D04F3B5D78; Sun, 15 Mar 2020 22:13:31 -0700 (PDT) (envelope-from chuq@chuq.com) Received: by spathi.chuq.com (Postfix, from userid 1022) id D853E3CFFA23; Sun, 15 Mar 2020 22:13:29 -0700 (PDT) Date: Sun, 15 Mar 2020 22:13:29 -0700 From: Chuck Silvers To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, glebius@freebsd.org Subject: Re: svn commit: r358597 - head/sys/kern Message-ID: <20200316051329.GA4598@spathi.chuq.com> References: <202003040022.0240Mpm6074186@repo.freebsd.org> <20200313234817.GA10027@spy> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200313234817.GA10027@spy> X-Rspamd-Queue-Id: 48gkwd5z57z4LWm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of chuq@chuq.com designates 166.84.7.169 as permitted sender) smtp.mailfrom=chuq@chuq.com X-Spamd-Result: default: False [-4.43 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[chuq.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-2.14)[ip: (-3.35), ipnet: 166.84.0.0/16(-4.06), asn: 2033(-3.25), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:2033, ipnet:166.84.0.0/16, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[36.24.4.24.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] 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: Mon, 16 Mar 2020 05:13:39 -0000 On Fri, Mar 13, 2020 at 07:48:17PM -0400, Mark Johnston wrote: > On Wed, Mar 04, 2020 at 12:22:51AM +0000, Chuck Silvers wrote: > > Author: chs > > Date: Wed Mar 4 00:22:50 2020 > > New Revision: 358597 > > URL: https://svnweb.freebsd.org/changeset/base/358597 > > > > Log: > > if vm_pager_get_pages_async() returns an error, release the sfio->nios > > refcount that we took earlier that represents the I/O that ended up > > not being started. > > I think a larger bug is that getpages_async is not consistent about > whether it invokes the completion callback in synchronous error cases. > For instance, vop_stdgetpages_async() always calls it, as does > ffs_getpages_async() when the filesystem fragment size is larger than > the page size. But vnode_pager_generic_getpages() does not. So if one > is using sendfile on a filesystem that does not implement > getpages_async, an error will cause sendfile_swapin() to unbusy the > input pages multiple times, and release the sfio refcount twice when it > should be done just once. ah yes, you're right. I was only looking at the path we actually hit. I think the simplest way to resolve this would be to change vnode_pager_generic_getpages() in the async case to always call the iodone callback and always return 0. (in the sync case vnode_pager_generic_getpages() would continue to return an error code if an error is encountered.) vm_pager_get_pages_async() could then be changed to return void since after the avoid changes it would always return 0. swap_pager_getpages_async() already always calls the iodone callback but it would return void too after the above changes. If that is agreeable to you and Gleb then I'll make the changes. -Chuck