diff options
Diffstat (limited to 'fs/dcache.c')
| -rw-r--r-- | fs/dcache.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index caf08574982f..9f2c13417969 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -536,7 +536,7 @@ restart: | |||
| 536 | */ | 536 | */ |
| 537 | static void prune_dcache(int count) | 537 | static void prune_dcache(int count) |
| 538 | { | 538 | { |
| 539 | struct super_block *sb, *n; | 539 | struct super_block *sb, *p = NULL; |
| 540 | int w_count; | 540 | int w_count; |
| 541 | int unused = dentry_stat.nr_unused; | 541 | int unused = dentry_stat.nr_unused; |
| 542 | int prune_ratio; | 542 | int prune_ratio; |
| @@ -550,7 +550,7 @@ static void prune_dcache(int count) | |||
| 550 | else | 550 | else |
| 551 | prune_ratio = unused / count; | 551 | prune_ratio = unused / count; |
| 552 | spin_lock(&sb_lock); | 552 | spin_lock(&sb_lock); |
| 553 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | 553 | list_for_each_entry(sb, &super_blocks, s_list) { |
| 554 | if (list_empty(&sb->s_instances)) | 554 | if (list_empty(&sb->s_instances)) |
| 555 | continue; | 555 | continue; |
| 556 | if (sb->s_nr_dentry_unused == 0) | 556 | if (sb->s_nr_dentry_unused == 0) |
| @@ -590,14 +590,16 @@ static void prune_dcache(int count) | |||
| 590 | up_read(&sb->s_umount); | 590 | up_read(&sb->s_umount); |
| 591 | } | 591 | } |
| 592 | spin_lock(&sb_lock); | 592 | spin_lock(&sb_lock); |
| 593 | /* lock was dropped, must reset next */ | 593 | if (p) |
| 594 | list_safe_reset_next(sb, n, s_list); | 594 | __put_super(p); |
| 595 | count -= pruned; | 595 | count -= pruned; |
| 596 | __put_super(sb); | 596 | p = sb; |
| 597 | /* more work left to do? */ | 597 | /* more work left to do? */ |
| 598 | if (count <= 0) | 598 | if (count <= 0) |
| 599 | break; | 599 | break; |
| 600 | } | 600 | } |
| 601 | if (p) | ||
| 602 | __put_super(p); | ||
| 601 | spin_unlock(&sb_lock); | 603 | spin_unlock(&sb_lock); |
| 602 | spin_unlock(&dcache_lock); | 604 | spin_unlock(&dcache_lock); |
| 603 | } | 605 | } |
