[rrd-developers] teting mmap/mtime updates
rep.dot.nop at gmail.com
Fri Dec 5 17:14:58 CET 2008
On Fri, Dec 05, 2008 at 04:04:15PM +0100, Tobias Oetiker wrote:
>Today Bernhard Reutner-Fischer wrote:
>> It would only complain on broken kernels which are way outdated by now.
>> Not sure whom you were asking all this, but see below.
>it works in recent linux kernel but the problem was only fixed
>sometime in 2007 I think ... you would not beleive what people are
>running rrdtool on ...
>Also I have reports that OSX does NOT work, even today.
>so I thought it would make sense todo something about it as backup
>systems fail to backup rrdfiles which seem to be un-changed.
>> > res = msync(addr, 4, MS_ASYNC);
>> > }
>> /* The ASYNC means that we schedule the msync and return immediately.
>> Since we want to see if the modification time is updated upon
>> msync(), we have to make sure that our asynchronous request
>> completes before we stat below. In a real application, the
>> request would be completed at a random time in the future
>> but for this test we do not want to wait an arbitrary amount of
>> time, so force a commit now. */
>> > stat(temp, &stbuf);
>Shouln't the representation in the filesystem be updated
>imediately, only the on-disk image would follow later ...
>but lets be 'friendly' and sync.
>what I am doing now, is to add a utime call right after open for
>all rw mmap access.
Please don't do that for the general case. This penalizes everybody
just because somebody may use broken kernels.
If you think that doing a bypass in rrdtool for that kernel-bug (samba and
alot of other packages also suffer from this, so only bypassing it in
rrdtool is pretty useless) then please wrap it in some
#if defined __linux__
#if LINUX_VERSION_CODE < 0x020615
/* kernels prior to e.g. 2.6.21 */
# define __BROKEN_POSIX_MSYNC_MTIME
So people with broken kernels can have their mtime updated manually
and the sane rest doesn't have to suffer.
Let me note that this whole mtime-is-not-updated is really only
a cosmetic issue for rrdtool. If you want to know if the rrd was
updated, just use "last" or "lastupdate" or the like.
More information about the rrd-developers