Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Trond Myklebust
On Wed, 2007-11-14 at 23:24 +0100, Nick Piggin wrote: > mmap()s can be different from read in that the syscall may have little > relation to when the data gets used. But I guess it's still a best > effort thing. Fair enough. Agreed that mmap() is special and very problematic on NFS. However I ca

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Trond Myklebust
On Wed, 2007-11-14 at 22:50 +0100, Peter Zijlstra wrote: > Right, but I guess what Nick asked is, if pages could be stale to start > with, how is that avoided in the future. > > The way I understand it, this re-validate is just a best effort at > getting a coherent image. The normal convention f

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Nick Piggin
On Wed, Nov 14, 2007 at 05:18:50PM -0500, Trond Myklebust wrote: > > On Wed, 2007-11-14 at 22:50 +0100, Peter Zijlstra wrote: > > Right, but I guess what Nick asked is, if pages could be stale to start > > with, how is that avoided in the future. > > > > The way I understand it, this re-validate

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Peter Zijlstra
On Wed, 2007-11-14 at 16:41 -0500, Trond Myklebust wrote: > On Wed, 2007-11-14 at 22:31 +0100, Peter Zijlstra wrote: > > On Wed, 2007-11-14 at 22:22 +0100, Nick Piggin wrote: > > > On Wed, Nov 14, 2007 at 09:01:39PM +0100, Peter Zijlstra wrote: > > > > Normal locking order is: > > > > > > > > i

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Trond Myklebust
On Wed, 2007-11-14 at 22:31 +0100, Peter Zijlstra wrote: > On Wed, 2007-11-14 at 22:22 +0100, Nick Piggin wrote: > > On Wed, Nov 14, 2007 at 09:01:39PM +0100, Peter Zijlstra wrote: > > > Normal locking order is: > > > > > > i_mutex > > > mmap_sem > > > > > > However NFS's ->mmap hook, whic

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Nick Piggin
On Wed, Nov 14, 2007 at 09:01:39PM +0100, Peter Zijlstra wrote: > Normal locking order is: > > i_mutex > mmap_sem > > However NFS's ->mmap hook, which is called under mmap_sem, can take i_mutex. > Avoid this potential deadlock by doing the work that requires i_mutex from > the new ->mmap_pr

Re: [PATCH 3/3] nfs: use ->mmap_prepare() to avoid an AB-BA deadlock

2007-11-14 Thread Peter Zijlstra
On Wed, 2007-11-14 at 22:22 +0100, Nick Piggin wrote: > On Wed, Nov 14, 2007 at 09:01:39PM +0100, Peter Zijlstra wrote: > > Normal locking order is: > > > > i_mutex > > mmap_sem > > > > However NFS's ->mmap hook, which is called under mmap_sem, can take i_mutex. > > Avoid this potential de