diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-03 00:02:25 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-03 16:45:06 -0400 |
| commit | fe91522a7ba82ca1a51b07e19954b3825e4aaa22 (patch) | |
| tree | c0676a69fe25019e6aaa2f676740e495ec8c1b1d | |
| parent | 41edf278fc2f042f4e22a12ed87d19c5201210e1 (diff) | |
don't remove from shrink list in select_collect()
If we find something already on a shrink list, just increment
data->found and do nothing else. Loops in shrink_dcache_parent() and
check_submounts_and_drop() will do the right thing - everything we
did put into our list will be evicted and if there had been nothing,
but data->found got non-zero, well, we have somebody else shrinking
those guys; just try again.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/dcache.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 58e26bee7ef4..f39a6f5a1220 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -1229,34 +1229,23 @@ static enum d_walk_ret select_collect(void *_data, struct dentry *dentry) | |||
| 1229 | if (data->start == dentry) | 1229 | if (data->start == dentry) |
| 1230 | goto out; | 1230 | goto out; |
| 1231 | 1231 | ||
| 1232 | /* | 1232 | if (dentry->d_flags & DCACHE_SHRINK_LIST) { |
| 1233 | * move only zero ref count dentries to the dispose list. | ||
| 1234 | * | ||
| 1235 | * Those which are presently on the shrink list, being processed | ||
| 1236 | * by shrink_dentry_list(), shouldn't be moved. Otherwise the | ||
| 1237 | * loop in shrink_dcache_parent() might not make any progress | ||
| 1238 | * and loop forever. | ||
| 1239 | */ | ||
| 1240 | if (dentry->d_lockref.count) { | ||
| 1241 | dentry_lru_del(dentry); | ||
| 1242 | } else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) { | ||
| 1243 | /* | ||
| 1244 | * We can't use d_lru_shrink_move() because we | ||
| 1245 | * need to get the global LRU lock and do the | ||
| 1246 | * LRU accounting. | ||
| 1247 | */ | ||
| 1248 | d_lru_del(dentry); | ||
| 1249 | d_shrink_add(dentry, &data->dispose); | ||
| 1250 | data->found++; | 1233 | data->found++; |
| 1251 | ret = D_WALK_NORETRY; | 1234 | } else { |
| 1235 | if (dentry->d_flags & DCACHE_LRU_LIST) | ||
| 1236 | d_lru_del(dentry); | ||
| 1237 | if (!dentry->d_lockref.count) { | ||
| 1238 | d_shrink_add(dentry, &data->dispose); | ||
| 1239 | data->found++; | ||
| 1240 | } | ||
| 1252 | } | 1241 | } |
| 1253 | /* | 1242 | /* |
| 1254 | * We can return to the caller if we have found some (this | 1243 | * We can return to the caller if we have found some (this |
| 1255 | * ensures forward progress). We'll be coming back to find | 1244 | * ensures forward progress). We'll be coming back to find |
| 1256 | * the rest. | 1245 | * the rest. |
| 1257 | */ | 1246 | */ |
| 1258 | if (data->found && need_resched()) | 1247 | if (!list_empty(&data->dispose)) |
| 1259 | ret = D_WALK_QUIT; | 1248 | ret = need_resched() ? D_WALK_QUIT : D_WALK_NORETRY; |
| 1260 | out: | 1249 | out: |
| 1261 | return ret; | 1250 | return ret; |
| 1262 | } | 1251 | } |
