]> git.baikalelectronics.ru Git - kernel.git/commit
fs: fix superblock iteration race
authornpiggin@suse.de <npiggin@suse.de>
Thu, 24 Jun 2010 03:02:14 +0000 (13:02 +1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2010 17:38:22 +0000 (10:38 -0700)
commit610a87b78974e751f2b70b7cb3b262ba6081ba95
treeec11dd35704aa37d77a5fd8404fda57f297a3834
parent4b10323f4604a390b274c7aee0101c13f8498dcf
fs: fix superblock iteration race

list_for_each_entry_safe is not suitable to protect against concurrent
modification of the list. a2f2501 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@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Frank Mayhar <fmayhar@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/dcache.c
fs/super.c
include/linux/list.h