diff options
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 3c6d3113a255..616fedff011a 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -243,6 +243,7 @@ static void dentry_lru_add(struct dentry *dentry) | |||
243 | static void __dentry_lru_del(struct dentry *dentry) | 243 | static void __dentry_lru_del(struct dentry *dentry) |
244 | { | 244 | { |
245 | list_del_init(&dentry->d_lru); | 245 | list_del_init(&dentry->d_lru); |
246 | dentry->d_flags &= ~DCACHE_SHRINK_LIST; | ||
246 | dentry->d_sb->s_nr_dentry_unused--; | 247 | dentry->d_sb->s_nr_dentry_unused--; |
247 | dentry_stat.nr_unused--; | 248 | dentry_stat.nr_unused--; |
248 | } | 249 | } |
@@ -806,6 +807,7 @@ relock: | |||
806 | spin_unlock(&dentry->d_lock); | 807 | spin_unlock(&dentry->d_lock); |
807 | } else { | 808 | } else { |
808 | list_move_tail(&dentry->d_lru, &tmp); | 809 | list_move_tail(&dentry->d_lru, &tmp); |
810 | dentry->d_flags |= DCACHE_SHRINK_LIST; | ||
809 | spin_unlock(&dentry->d_lock); | 811 | spin_unlock(&dentry->d_lock); |
810 | if (!--count) | 812 | if (!--count) |
811 | break; | 813 | break; |
@@ -1097,14 +1099,19 @@ resume: | |||
1097 | 1099 | ||
1098 | /* | 1100 | /* |
1099 | * move only zero ref count dentries to the dispose list. | 1101 | * move only zero ref count dentries to the dispose list. |
1102 | * | ||
1103 | * Those which are presently on the shrink list, being processed | ||
1104 | * by shrink_dentry_list(), shouldn't be moved. Otherwise the | ||
1105 | * loop in shrink_dcache_parent() might not make any progress | ||
1106 | * and loop forever. | ||
1100 | */ | 1107 | */ |
1101 | if (!dentry->d_count) { | 1108 | if (dentry->d_count) { |
1109 | dentry_lru_del(dentry); | ||
1110 | } else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) { | ||
1102 | dentry_lru_move_list(dentry, dispose); | 1111 | dentry_lru_move_list(dentry, dispose); |
1112 | dentry->d_flags |= DCACHE_SHRINK_LIST; | ||
1103 | found++; | 1113 | found++; |
1104 | } else { | ||
1105 | dentry_lru_del(dentry); | ||
1106 | } | 1114 | } |
1107 | |||
1108 | /* | 1115 | /* |
1109 | * We can return to the caller if we have found some (this | 1116 | * We can return to the caller if we have found some (this |
1110 | * ensures forward progress). We'll be coming back to find | 1117 | * ensures forward progress). We'll be coming back to find |