aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/dcache.c12
-rw-r--r--fs/super.c36
2 files changed, 28 insertions, 20 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 */
537static void prune_dcache(int count) 537static 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}
diff --git a/fs/super.c b/fs/super.c
index bd9eea4bb2bb..9674ab2c8718 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -363,10 +363,10 @@ EXPORT_SYMBOL(drop_super);
363 */ 363 */
364void sync_supers(void) 364void sync_supers(void)
365{ 365{
366 struct super_block *sb, *n; 366 struct super_block *sb, *p = NULL;
367 367
368 spin_lock(&sb_lock); 368 spin_lock(&sb_lock);
369 list_for_each_entry_safe(sb, n, &super_blocks, s_list) { 369 list_for_each_entry(sb, &super_blocks, s_list) {
370 if (list_empty(&sb->s_instances)) 370 if (list_empty(&sb->s_instances))
371 continue; 371 continue;
372 if (sb->s_op->write_super && sb->s_dirt) { 372 if (sb->s_op->write_super && sb->s_dirt) {
@@ -379,11 +379,13 @@ void sync_supers(void)
379 up_read(&sb->s_umount); 379 up_read(&sb->s_umount);
380 380
381 spin_lock(&sb_lock); 381 spin_lock(&sb_lock);
382 /* lock was dropped, must reset next */ 382 if (p)
383 list_safe_reset_next(sb, n, s_list); 383 __put_super(p);
384 __put_super(sb); 384 p = sb;
385 } 385 }
386 } 386 }
387 if (p)
388 __put_super(p);
387 spin_unlock(&sb_lock); 389 spin_unlock(&sb_lock);
388} 390}
389 391
@@ -397,10 +399,10 @@ void sync_supers(void)
397 */ 399 */
398void iterate_supers(void (*f)(struct super_block *, void *), void *arg) 400void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
399{ 401{
400 struct super_block *sb, *n; 402 struct super_block *sb, *p = NULL;
401 403
402 spin_lock(&sb_lock); 404 spin_lock(&sb_lock);
403 list_for_each_entry_safe(sb, n, &super_blocks, s_list) { 405 list_for_each_entry(sb, &super_blocks, s_list) {
404 if (list_empty(&sb->s_instances)) 406 if (list_empty(&sb->s_instances))
405 continue; 407 continue;
406 sb->s_count++; 408 sb->s_count++;
@@ -412,10 +414,12 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
412 up_read(&sb->s_umount); 414 up_read(&sb->s_umount);
413 415
414 spin_lock(&sb_lock); 416 spin_lock(&sb_lock);
415 /* lock was dropped, must reset next */ 417 if (p)
416 list_safe_reset_next(sb, n, s_list); 418 __put_super(p);
417 __put_super(sb); 419 p = sb;
418 } 420 }
421 if (p)
422 __put_super(p);
419 spin_unlock(&sb_lock); 423 spin_unlock(&sb_lock);
420} 424}
421 425
@@ -577,10 +581,10 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
577 581
578static void do_emergency_remount(struct work_struct *work) 582static void do_emergency_remount(struct work_struct *work)
579{ 583{
580 struct super_block *sb, *n; 584 struct super_block *sb, *p = NULL;
581 585
582 spin_lock(&sb_lock); 586 spin_lock(&sb_lock);
583 list_for_each_entry_safe(sb, n, &super_blocks, s_list) { 587 list_for_each_entry(sb, &super_blocks, s_list) {
584 if (list_empty(&sb->s_instances)) 588 if (list_empty(&sb->s_instances))
585 continue; 589 continue;
586 sb->s_count++; 590 sb->s_count++;
@@ -594,10 +598,12 @@ static void do_emergency_remount(struct work_struct *work)
594 } 598 }
595 up_write(&sb->s_umount); 599 up_write(&sb->s_umount);
596 spin_lock(&sb_lock); 600 spin_lock(&sb_lock);
597 /* lock was dropped, must reset next */ 601 if (p)
598 list_safe_reset_next(sb, n, s_list); 602 __put_super(p);
599 __put_super(sb); 603 p = sb;
600 } 604 }
605 if (p)
606 __put_super(p);
601 spin_unlock(&sb_lock); 607 spin_unlock(&sb_lock);
602 kfree(work); 608 kfree(work);
603 printk("Emergency Remount complete\n"); 609 printk("Emergency Remount complete\n");