linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zach Brown <zach.brown@oracle.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking
Date: Wed, 7 Feb 2007 15:34:28 -0500	[thread overview]
Message-ID: <DE08DC9F-AE21-4DE3-A1C9-8429651DAB66@oracle.com> (raw)
In-Reply-To: <20070207202228.GE11967@think.oraclecorp.com>

>
> The test case Linus sent me boils down to this:
>
> fd = open(file)
> buffer = mmap(fd, 128 pages);
> close(fd);
> fd = open(file, O_DIRECT);
> write(fd, buffer, 66 pages);

Yeah, though I bet the inner close/open isn't needed.

> I think the deadlock is limited to cases where get_user_pages will get
> stuck in filemap_nopage waiting for placeholders inserted by this DIO.

Yeah.

> It looks like that can only happen when buffer is mapped at the  
> start of
> the dio.

At the *start* of the dio or by the time get_user_pages() is called?

The dio and mmap() aren't serialized, are they?  mmap() just sets up  
the vma, I thought, and will only touch the mmap_sem.

I'm fearing threads racing write(fd, buffer, ) and mmap(buffer,  
MAP_FIXED...).

I might just be missing the locking that serializes them.  If nothing  
else, this should be mentioned in the comment above the code that  
looks like a racy test against the presence of a mapping.

- z

  reply	other threads:[~2007-02-07 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07  0:32 [RFC PATCH 0 of 8] O_DIRECT locking rework Chris Mason
2007-02-07  0:32 ` [PATCH 1 of 8] Introduce a place holder page for the pagecache Chris Mason
2007-02-07 17:36   ` Zach Brown
2007-02-07  0:32 ` [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking Chris Mason
2007-02-07 20:11   ` Zach Brown
2007-02-07 20:22     ` Chris Mason
2007-02-07 20:34       ` Zach Brown [this message]
2007-02-07  0:32 ` [PATCH 3 of 8] DIO: don't fall back to buffered writes Chris Mason
2007-02-07  0:32 ` [PATCH 4 of 8] Add flags to control direct IO helpers Chris Mason
2007-02-07 17:08   ` Suparna Bhattacharya
2007-02-07 18:05     ` Chris Mason
2007-02-08  4:03       ` Suparna Bhattacharya
2007-02-08 12:58         ` Chris Mason
2007-02-07  0:32 ` [PATCH 5 of 8] Make ext3 safe for the new DIO locking rules Chris Mason
2007-02-07  0:32 ` [PATCH 6 of 8] Make reiserfs safe for " Chris Mason
2007-02-07  0:32 ` [PATCH 7 of 8] Adapt XFS to the new blockdev_direct_IO calls Chris Mason
2007-02-07  0:32 ` [PATCH 8 of 8] Avoid too many boundary buffers in DIO Chris Mason
  -- strict thread matches above, loose matches on Subject: below --
2006-12-22  1:45 [PATCH 0 of 8] O_DIRECT locking rework v5 Chris Mason
2006-12-22  1:55 ` [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking Chris Mason

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=DE08DC9F-AE21-4DE3-A1C9-8429651DAB66@oracle.com \
    --to=zach.brown@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris.mason@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).