linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Martin Uecker <muecker@gwdg.de>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: reliably detect writes to a file: mmap, mtime, ...
Date: Tue, 29 Dec 2015 22:20:36 -0800	[thread overview]
Message-ID: <CALCETrXTaqTa-1YTrmsvNY1fvv0CMkQNVn+zVWp4ipT06v=4wQ@mail.gmail.com> (raw)
In-Reply-To: <20151229212420.004b315f@lemur>

On Dec 30, 2015 4:24 AM, "Martin Uecker" <muecker@gwdg.de> wrote:
>
>
>
> Hi all,
>
> I want to reliably detect changes to a file even when
> written to using mmap. Surprisingly, there seems to be
> no API which would make this possible. Or at least I
> haven't found a way to do it...
>
>
> I looked at:
>
> - mtime. What is missing here is an API which would
> force mtime to be updated if there are dirty PTEs
> in some mapping (which need to be cleared/transferred
> to struct page at this point). This would allow to
> reliably detect changes to the file. If I understand it
> correctly, there was patch from Andy Lutomirski which
> made msync(ASYNC) do exactly this:
>
> http://oss.sgi.com/archives/xfs/2013-08/msg00748.html
>
> But it seems this never got in. The other problem with
> this is that mtime has limited granularity.
> (but maybe that could be worked around by having some
> kind of counter + API which tells how often mtime has
> been updated without changing its nominal value)

Those patches plus nanosecond granularity should do it, I think.  I
keep meaning to dust them off.  You could do it :)

--Andy

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-12-30  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-29 20:24 Martin Uecker
2015-12-30  6:20 ` Andy Lutomirski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALCETrXTaqTa-1YTrmsvNY1fvv0CMkQNVn+zVWp4ipT06v=4wQ@mail.gmail.com' \
    --to=luto@amacapital.net \
    --cc=linux-mm@kvack.org \
    --cc=muecker@gwdg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox