From owner-freebsd-fs@freebsd.org Fri Sep 22 15:46:48 2017 Return-Path: Delivered-To: freebsd-fs@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 3C0E5E0263F for ; Fri, 22 Sep 2017 15:46:48 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from dss.incore.de (dss.incore.de [195.145.1.138]) (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 00B1B711DF for ; Fri, 22 Sep 2017 15:46:47 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from inetmail.dmz (inetmail.dmz [10.3.0.3]) by dss.incore.de (Postfix) with ESMTP id B6E1011FF; Fri, 22 Sep 2017 17:46:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at incore.de Received: from dss.incore.de ([10.3.0.3]) by inetmail.dmz (inetmail.dmz [10.3.0.3]) (amavisd-new, port 10024) with LMTP id kKOC4Mspx48t; Fri, 22 Sep 2017 17:46:43 +0200 (CEST) Received: from mail.local.incore (fwintern.dmz [10.0.0.253]) by dss.incore.de (Postfix) with ESMTP id 10E34125F; Fri, 22 Sep 2017 17:46:43 +0200 (CEST) Received: from bsdlo.incore (bsdlo.incore [192.168.0.84]) by mail.local.incore (Postfix) with ESMTP id F0A8D508A2; Fri, 22 Sep 2017 17:46:42 +0200 (CEST) Message-ID: <59C53062.5070709@incore.de> Date: Fri, 22 Sep 2017 17:46:42 +0200 From: Andreas Longwitz User-Agent: Thunderbird 2.0.0.19 (X11/20090113) MIME-Version: 1.0 To: Konstantin Belousov CC: Kirk McKusick , freebsd-fs@freebsd.org Subject: Re: fsync: giving up on dirty on ufs partitions running vfs_write_suspend() References: <201709110519.v8B5JVmf060773@chez.mckusick.com> <59BD0EAC.8030206@incore.de> <20170916183117.GF78693@kib.kiev.ua> <59C37F46.80509@incore.de> <20170921172902.GW78693@kib.kiev.ua> <59C4DF8D.5070004@incore.de> <20170922102917.GC2271@kib.kiev.ua> In-Reply-To: <20170922102917.GC2271@kib.kiev.ua> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 15:46:48 -0000 Konstantin Belousov wroze: > On Fri, Sep 22, 2017 at 12:01:49PM +0200, Andreas Longwitz wrote: >> Patch against HEAD: > Of course I meant the patch which waits for secondary writers to pass. > >> --- vfs_default.c.orig 2017-09-22 11:56:26.950084000 +0200 >> +++ vfs_default.c 2017-09-22 11:58:33.211196000 +0200 >> @@ -690,6 +690,8 @@ >> bremfree(bp); >> bawrite(bp); >> } >> + if( maxretry < 1000) >> + DELAY(1000); /* 1 ms */ >> BO_LOCK(bo); >> goto loop2; >> } Excuse me, but I don't have a patch which waits for secondary writers to pass. As I posted before I have checked using a dtrace script, that the counter bo->bo_dirty.bv_cnt (which is used by the kernel) always goes to zero, when the secondary writes (as you explained: meaning number of threads in vn_start_secondary_write) goes to zero. To be exact: bo->bo_dirty.bv_cnt goes to zero one loop step later than mnt_secondary_writes. But without bumping up maxres or introducing some kind of DELAY we will sometimes trigger the "giving up on dirty" message. First of all I prefer to get rid of this message. Your proposal to check the secondary writes would be a further improvement of the code. -- Andreas Longwitz