Messages in this thread Patch in this message | | | Date | Fri, 8 Jan 2010 01:45:13 +0100 | From | Andi Kleen <> | Subject | Re: [GIT PULL] Please pull NFS client bugfixes.... |
| |
> If that is ok, then why do the revalidate at all? Just do the open/close > consistency and validate at open time, not mmap time.
That's exactly what my patch does :)
-Andi
---
NFS: don't revalidate in mmap v2
nfs_revalidate_mapping takes i_mutex, but mmap already has mmap_sem and taking i_mutex inside mmap_sem is not allowed by the VFS.
So don't revalidate on mmap time. In theory users could rely on it, but it's unlikely enough for mmap.
This fixes a lockdep warning that happens at every boot on my nfsroot test system.
v2: Fix unused variable warning, add comment
Signed-off-by: Andi Kleen <ak@linux.intel.com>
--- fs/nfs/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Index: linux/fs/nfs/file.c =================================================================== --- linux.orig/fs/nfs/file.c +++ linux/fs/nfs/file.c @@ -291,20 +291,20 @@ static int nfs_file_mmap(struct file * file, struct vm_area_struct * vma) { struct dentry *dentry = file->f_path.dentry; - struct inode *inode = dentry->d_inode; int status; dprintk("NFS: mmap(%s/%s)\n", dentry->d_parent->d_name.name, dentry->d_name.name); - /* Note: generic_file_mmap() returns ENOSYS on nommu systems - * so we call that before revalidating the mapping - */ status = generic_file_mmap(file, vma); - if (!status) { + /* + * This used to be a synchronization point, + * but this causes lock order inversions with i_mutex / mmap_sem. + * It's unclear anyone relies on mmap being a synchronization + * point anyways, so just removed it here -AK + */ + if (!status) vma->vm_ops = &nfs_file_vm_ops; - status = nfs_revalidate_mapping(inode, file->f_mapping); - } return status; } -- ak@linux.intel.com -- Speaking for myself only.
| |