linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] O_DIRECT locking rework
@ 2006-10-20 18:32 Chris Mason
  2006-10-20 18:38 ` [RFC PATCH 1/2] placeholder pages Chris Mason
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Chris Mason @ 2006-10-20 18:32 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: akpm, zach.brown

Hello everyone,

O_DIRECT locking currently uses a few different per-inode locks to
prevent races between buffered io and direct io.  This is awkward, and
sometimes grows races where we expose old data on disk.

For example, I can't quite see how we protect from an mmap triggered
writepage from filling a hole in the middle of an O_DIRECT read.

This patch set changes O_DIRECT to use page locks instead of
mutex/semaphores.  It looks in the radix tree for pages affected by this
O_DIRECT read/wrte and locks any pages it finds.

For any pages not present, a stub page struct is inserted into the
radix tree.  The page cache routines are changed to either wait on this
place holder page or ignore it as appropriate.  Place holders are not
valid pages at all, you can't trust page->index or any other field.

The first patch introduces these place holder pages.  The second patch
changes fs/direct-io.c to use them.  Patch #2 needs work,
direct-io.c:lock_page_range can be made much faster, and it needs to be
changed to work in chunks instead of pinning down the whole range at
once.

But, this is enough for people to comment on the basic idea.  Testing
has been very light. I'm not sure I've covered all of the buffered vs
direct races yet.  The main goal of posting now is to talk about the
place holder pages and possible optimizations.

For the XFS guys, you probably want to avoid the page locking steps as
well, a later version will honor that.

-chris


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-10-24 22:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20 18:32 [RFC PATCH 0/2] O_DIRECT locking rework Chris Mason
2006-10-20 18:38 ` [RFC PATCH 1/2] placeholder pages Chris Mason
2006-10-20 18:41 ` [RFC PATCH 1/2] page cache locking for O_DIRECT Chris Mason
2006-10-20 19:30 ` [RFC PATCH 0/2] O_DIRECT locking rework Andrew Morton
2006-10-20 20:03   ` Zach Brown
2006-10-20 20:12     ` Chris Mason
2006-10-20 20:05   ` Chris Mason
2006-10-20 20:23   ` Andi Kleen
2006-10-24 19:34 ` Chris Mason
2006-10-24 19:38   ` [RFC PATCH 1/2] placeholder pages Chris Mason
2006-10-24 19:40   ` [RFC PATCH 2/2] O_DIRECT locking via placeholders Chris Mason
2006-10-24 20:28   ` [RFC PATCH 0/2] O_DIRECT locking rework Badari Pulavarty
2006-10-24 20:50     ` Chris Mason
2006-10-24 21:52       ` Badari Pulavarty
2006-10-24 22:22         ` Chris Mason
2006-10-24 22:47           ` Badari Pulavarty
2006-10-24 22:37       ` Russell Cattelan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).