Re: fsync



On Dec 27, 5:19 pm, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:
Mike <michael.h.william...@xxxxxxxxx> writes:

[...]

Also, I have not concerned myself with how mmap() works, so this is
a surprise to me. I think it might be helpful to others if the man
page for fsync() mentioned msync() in the description, and that
fsync() does not work for mmap()'ed file access.

What do you think?

The mmap(2) manpage documents the need for using msync in certain
cases:

MAP_SHARED Share this mapping with all other processes that
map this object. Storing to the region is equivalent to
writing to the file. The file may not actually be updated
until msync(2) or munmap(2) are called.

I think it is reasonable to expect people to read the mmap manpage
before using this system call.

This mode, MAP_SHARED, is indeed the mode my program uses.
And I probably overlooked the mention of msync() when I read
the man page for mmap().

But, I ask, if "Storing to the region is _equivalent_ to writing to
the file", then should I not expect fsync() on that file
descriptor to work?

-Mike
.



Relevant Pages

  • Re: how do file-mapped (mmapped) pages become dirty?
    ... > only a specific portion and control how that portion is ... According to Rik van Riel and HPA, fsync() does not check page tables ... This is confirmed by my testing, in which msync() takes ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: fsync
    ... | The fsyncfunction is not flushing data to the disk in my program. ... Use msync() to update the data ... I think it might be helpful to others if the man page for fsync() ...
    (comp.os.linux.development.system)
  • msync/fsync - block process or thread ?
    ... In a multithreaded environment will a call to msync ... or a call to fsync() block the calling thread or the whole ... process until the I/O is complete? ...
    (comp.os.linux.development.system)
  • Re: io priorities?
    ... > I've got a computer with one IDE disk. ... > process periodically writing a tiny little state file, ... > The process with the state file wants to sync its file to disk and then ... When it calls fsync() it has to wait for ...
    (Linux-Kernel)
  • Re: Strange write starvation on 2.6.17 (and other) kernels
    ... writing a large file on a busy machine, a single writeof 64KB may ... But if I do fsync() after each writethe maximum ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)