From f23e80d7aef086c72067bb96a993a02fc29ed03a Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sun, 1 Nov 2009 16:03:17 -0500 Subject: [PATCH] Linux: Avoid deadlock in readdir - release GLOCK for filldir The GLOCK is held while calling the filldir function in afs_linux_readdir(). If this function causes a page fault, and in particular if this fault involves AFS, we're in trouble as we'll eventually deadlock in the readpage code. A simple test case for this is to call the getdents syscall on an AFS directory with a buffer that is part of an mmaped AFS file. This is already the case in the master branch; the change was part of the merge of the NFS translator code. FIXES 125555 Change-Id: I829838e45f94921d22335154587216f7842e3955 Reviewed-on: http://gerrit.openafs.org/760 Tested-by: Marc Dionne Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 612589b66..bcdcb3d82 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -310,7 +310,9 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) /* clean up from afs_FindVCache */ afs_PutVCache(tvc); } + AFS_GUNLOCK(); code = (*filldir) (dirbuf, de->name, len, offset, ino, type); + AFS_GLOCK(); } #else code = (*filldir) (dirbuf, de->name, len, offset, ino); -- 2.39.5