Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Mar 2017 16:19:17 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Rick Macklem <rmacklem@uoguelph.ca>
Cc:        Dimitry Andric <dim@FreeBSD.org>, Ian Lepore <ian@FreeBSD.org>, Gergely Czuczy <gergely.czuczy@harmless.hu>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: process killed: text file modification
Message-ID:  <20170317141917.GS16105@kib.kiev.ua>
In-Reply-To: <YTXPR01MB0189F7147A7C5C5F8C56B2F1DD390@YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM>
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> <FF55DB37-4A6B-4D88-B201-B3BCA1A11E87@FreeBSD.org> <YTXPR01MB01898D49933A82170FCAB7A0DD390@YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM> <YTXPR01MB018944EF4248402AD421D825DD390@YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM> <20170317083605.GQ16105@kib.kiev.ua> <YTXPR01MB0189F7147A7C5C5F8C56B2F1DD390@YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170317141917.GS16105>