Not sure if this is really the _cleanest_ way to fix it. But open coding the list walking is a bit annoying too. And I couldn't see any real way to make the list macro safe. Better ideas? Thanks, Nick -- list_for_each_entry_safe is not suitable to protect against concurrent modification of the list. 6754af6 introduced a race in sb walking. list_for_each_entry can use the trick of pinning the current entry in the list before we drop and retake the lock because it subsequently follows cur->next. However list_for_each_entry_safe saves n=cur->next for following before entering the loop body, so when the lock is dropped, n may be deleted. Signed-off-by: Nick Piggin <npiggin@xxxxxxx> --- fs/dcache.c | 2 ++ fs/super.c | 6 ++++++ 2 files changed, 8 insertions(+) Index: linux-2.6/fs/dcache.c =================================================================== --- linux-2.6.orig/fs/dcache.c 2010-06-12 00:00:10.000000000 +1000 +++ linux-2.6/fs/dcache.c 2010-06-12 00:38:21.000000000 +1000 @@ -590,6 +590,8 @@ static void prune_dcache(int count) up_read(&sb->s_umount); } spin_lock(&sb_lock); + /* old n may have been deleted */ + n = list_entry(sb->s_list.next, struct super_block, s_list); count -= pruned; __put_super(sb); /* more work left to do? */ Index: linux-2.6/fs/super.c =================================================================== --- linux-2.6.orig/fs/super.c 2010-06-11 23:55:40.000000000 +1000 +++ linux-2.6/fs/super.c 2010-06-12 00:38:40.000000000 +1000 @@ -374,6 +374,8 @@ void sync_supers(void) up_read(&sb->s_umount); spin_lock(&sb_lock); + /* old n may have been deleted */ + n = list_entry(sb->s_list.next, struct super_block, s_list); __put_super(sb); } } @@ -405,6 +407,8 @@ void iterate_supers(void (*f)(struct sup up_read(&sb->s_umount); spin_lock(&sb_lock); + /* old n may have been deleted */ + n = list_entry(sb->s_list.next, struct super_block, s_list); __put_super(sb); } spin_unlock(&sb_lock); @@ -585,6 +589,8 @@ static void do_emergency_remount(struct } up_write(&sb->s_umount); spin_lock(&sb_lock); + /* old n may have been deleted */ + n = list_entry(sb->s_list.next, struct super_block, s_list); __put_super(sb); } spin_unlock(&sb_lock); -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html