aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-13 12:51:06 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:36 -0400
commit9c7e7e23371e629dbb3b341610a418cdf1c19d91 (patch)
treec211183b99860d232500bf99d12775e47c4f0f9c /fs
parent1a81bb8a1fa62ccb9b2411ac10ce702ca4ed302a (diff)
NFS: Don't call iput() in nfs_access_cache_shrinker
iput() can potentially attempt to allocate memory, so we should avoid calling it in a memory shrinker. Instead, rely on the fact that iput() will call nfs_access_zap_cache(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 1c71fc213716..ee9a179ebdf3 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1716,22 +1716,14 @@ int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask)
1716 1716
1717 if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL) 1717 if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL)
1718 return (nr_to_scan == 0) ? 0 : -1; 1718 return (nr_to_scan == 0) ? 0 : -1;
1719restart: 1719
1720 spin_lock(&nfs_access_lru_lock); 1720 spin_lock(&nfs_access_lru_lock);
1721 list_for_each_entry(nfsi, &nfs_access_lru_list, access_cache_inode_lru) { 1721 list_for_each_entry(nfsi, &nfs_access_lru_list, access_cache_inode_lru) {
1722 struct rw_semaphore *s_umount;
1723 struct inode *inode; 1722 struct inode *inode;
1724 1723
1725 if (nr_to_scan-- == 0) 1724 if (nr_to_scan-- == 0)
1726 break; 1725 break;
1727 s_umount = &nfsi->vfs_inode.i_sb->s_umount; 1726 inode = &nfsi->vfs_inode;
1728 if (!down_read_trylock(s_umount))
1729 continue;
1730 inode = igrab(&nfsi->vfs_inode);
1731 if (inode == NULL) {
1732 up_read(s_umount);
1733 continue;
1734 }
1735 spin_lock(&inode->i_lock); 1727 spin_lock(&inode->i_lock);
1736 if (list_empty(&nfsi->access_cache_entry_lru)) 1728 if (list_empty(&nfsi->access_cache_entry_lru))
1737 goto remove_lru_entry; 1729 goto remove_lru_entry;
@@ -1745,13 +1737,10 @@ restart:
1745 else { 1737 else {
1746remove_lru_entry: 1738remove_lru_entry:
1747 list_del_init(&nfsi->access_cache_inode_lru); 1739 list_del_init(&nfsi->access_cache_inode_lru);
1740 smp_mb__before_clear_bit();
1748 clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); 1741 clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags);
1742 smp_mb__after_clear_bit();
1749 } 1743 }
1750 spin_unlock(&inode->i_lock);
1751 spin_unlock(&nfs_access_lru_lock);
1752 iput(inode);
1753 up_read(s_umount);
1754 goto restart;
1755 } 1744 }
1756 spin_unlock(&nfs_access_lru_lock); 1745 spin_unlock(&nfs_access_lru_lock);
1757 nfs_access_free_list(&head); 1746 nfs_access_free_list(&head);