Re: [GIT PULL] Please pull NFS client bugfixes....

From: Andi Kleen
Date: Thu Jan 07 2010 - 19:45:23 EST


> 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@xxxxxxxxxxxxxxx>

---
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@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/