NFS: Don't run nfs_access_cache_shrinker() when the mask is GFP_NOFS
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 13 May 2010 16:51:06 +0000 (12:51 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 14 May 2010 19:09:35 +0000 (15:09 -0400)
Both iput() and put_rpccred() might allocate memory under certain
circumstances, so make sure that we don't recurse and deadlock...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/dir.c

index 18da8abbece8ccef3dd3fee9eacc045cd1999c5a..58b1f744c91e476de7c8cc50e562f4f51e33c88f 100644 (file)
@@ -1703,6 +1703,8 @@ int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask)
        struct nfs_inode *nfsi;
        struct nfs_access_entry *cache;
 
+       if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL)
+               return (nr_to_scan == 0) ? 0 : -1;
 restart:
        spin_lock(&nfs_access_lru_lock);
        list_for_each_entry(nfsi, &nfs_access_lru_list, access_cache_inode_lru) {