NFS: We must use list_for_each_entry_safe in nfs_access_cache_shrinker
We may end up removing the current entry from nfs_access_lru_list. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
a00dd6c03d
commit
aa510da5bf
1 changed files with 2 additions and 2 deletions
|
@ -1788,14 +1788,14 @@ static void nfs_access_free_list(struct list_head *head)
|
||||||
int nfs_access_cache_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
|
int nfs_access_cache_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
|
||||||
{
|
{
|
||||||
LIST_HEAD(head);
|
LIST_HEAD(head);
|
||||||
struct nfs_inode *nfsi;
|
struct nfs_inode *nfsi, *next;
|
||||||
struct nfs_access_entry *cache;
|
struct nfs_access_entry *cache;
|
||||||
|
|
||||||
if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL)
|
if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL)
|
||||||
return (nr_to_scan == 0) ? 0 : -1;
|
return (nr_to_scan == 0) ? 0 : -1;
|
||||||
|
|
||||||
spin_lock(&nfs_access_lru_lock);
|
spin_lock(&nfs_access_lru_lock);
|
||||||
list_for_each_entry(nfsi, &nfs_access_lru_list, access_cache_inode_lru) {
|
list_for_each_entry_safe(nfsi, next, &nfs_access_lru_list, access_cache_inode_lru) {
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
if (nr_to_scan-- == 0)
|
if (nr_to_scan-- == 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue