From: Zach Brown <zach.brown@oracle.com>
To: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Steve French <smfltc@us.ibm.com>,
linux-fsdevel@vger.kernel.org,
Shirish S Pargaonkar <shirishp@us.ibm.com>
Subject: Re: What trigge fsync of file on last close of the open inode?
Date: Tue, 03 Oct 2006 16:43:10 -0700 [thread overview]
Message-ID: <4522F58E.7070903@oracle.com> (raw)
In-Reply-To: <1159911626.18918.20.camel@kleikamp.austin.ibm.com>
>> Are writes to mmap()ed regions involved at all? They lead to pages
>> being dirtied at unmapping and eventually hitting ->writepage,
>> potentially after ->flush and ->release have been called.
>
> ->flush does filemap_fdatawrite(), which should take care of any dirty
> pages (I believe).
Not if they come from writes to mmap()ed pages. The page cache won't
see them as dirty until they're unmapped and the page table dirty bits
are transfered to the page cache page flags.
unmapping to transfer dirty tracking from page tables to the page cache
is done in a few places. look for calls to unmap_mapping_range() like
this one from the O_DIRECT write path:
/*
* If it's a write, unmap all mmappings of the file up-front. This
* will cause any pte dirty bits to be propagated into the pageframes
* for the subsequent filemap_write_and_wait().
*/
if (rw == WRITE) {
write_len = iov_length(iov, nr_segs);
if (mapping_mapped(mapping))
unmap_mapping_range(mapping, offset, write_len, 0);
}
I'd hope that dirty tracking is transferred from the page tables to the
page cache *before* ->release is called. (put_vma() makes me think this
is the case.) So I think you could use unmap_mapping_range() and
filemap_fdatawrite() to at least initiate writeback on all dirty pages
in ->release.
That is, you should be able to stop ->writepages calls after ->release.
But it's a really bad idea to try and assert that ->writepages can't be
called after ->flush.
But I still don't know if mmap() is involved in his current problem.
- z
next prev parent reply other threads:[~2006-10-03 23:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-03 19:53 What trigge fsync of file on last close of the open inode? Steve French
2006-10-03 20:05 ` Dave Kleikamp
2006-10-03 20:45 ` Steve French
2006-10-03 21:15 ` Zach Brown
2006-10-03 21:40 ` Dave Kleikamp
2006-10-03 23:43 ` Zach Brown [this message]
2006-10-04 15:13 ` Steve French
2006-10-03 23:13 ` Jeremy Allison
2006-10-04 20:46 ` Trond Myklebust
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=4522F58E.7070903@oracle.com \
--to=zach.brown@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shaggy@austin.ibm.com \
--cc=shirishp@us.ibm.com \
--cc=smfltc@us.ibm.com \
/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