From owner-freebsd-current@freebsd.org Fri Mar 17 14:19:22 2017 Return-Path: Delivered-To: freebsd-current@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 B84BCD10EE6 for ; Fri, 17 Mar 2017 14:19:22 +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 32B051C56; Fri, 17 Mar 2017 14:19:22 +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 v2HEJHRc090524 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 17 Mar 2017 16:19:17 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v2HEJHRc090524 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v2HEJHYF090523; Fri, 17 Mar 2017 16:19:17 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Mar 2017 16:19:17 +0200 From: Konstantin Belousov To: Rick Macklem Cc: Dimitry Andric , Ian Lepore , Gergely Czuczy , FreeBSD Current Subject: Re: process killed: text file modification Message-ID: <20170317141917.GS16105@kib.kiev.ua> References: <45436522-77df-f894-0569-737a6a74958f@harmless.hu> <55189643.aaZPuY77s8@ralph.baldwin.cx> <3ed3e4a3-23af-7267-39f1-9090093c9c1e@harmless.hu> <5ac94b9a-7ced-9eff-d746-7dddaaeca516@harmless.hu> <1489340839.40576.82.camel@freebsd.org> <20170317083605.GQ16105@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) 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: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Mar 2017 14:19:22 -0000 On Fri, Mar 17, 2017 at 01:53:46PM +0000, Rick Macklem wrote: > Well, I don't mind adding ncl_flush(), but it shouldn't be > necessary. I actually had it in the first > rendition of the patch, but took it out because it should happen > on the VOP_CLOSE() if any writing to the buffer cache happened > and that code hasn't changed in many years. Dirty pages are flushed by writes, so if we have a set of dirty pages and async vm_object_page_clean() is called on the vnode' vm_object, we get a bunch of delayed-write AKA dirty buffers. This is possible even after VOP_CLOSE() was done, e.g. by syncer performing regular run involving vfs_msync(). I agree that the patch would not create new dirty buffers, but it is possible to get them by other means. > > What the patch was missing was updating n_mtime after the dirty > page flush. > > Btw, a flush without OBJPC_SYNC happens when the file is VOP_CLOSE()'d > unless the default value of vfs.nfs.clean_[ages_on_close is changed, which > I think is why the 1sec resolution always seemed to work, at least for the > example where there was an munmap before close. > > Attached is an updated version with that in it, rick