]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] fix for prune_icache()/forced final iput() races
authorAlexander Viro <aviro@redhat.com>
Thu, 23 Jun 2005 07:09:01 +0000 (00:09 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 23 Jun 2005 16:45:17 +0000 (09:45 -0700)
commit5ced61e42c2ca96d1f8d958adffdb85fc89ac303
treecc81f871756a70a3312552409ee5cacd6625aa1d
parent4744d9dfcaabce05429592e577b4a03eda89f06b
[PATCH] fix for prune_icache()/forced final iput() races

Based on analysis and a patch from Russ Weight <rweight@us.ibm.com>

There is a race condition that can occur if an inode is allocated and then
released (using iput) during the ->fill_super functions.  The race
condition is between kswapd and mount.

For most filesystems this can only happen in an error path when kswapd is
running concurrently.  For isofs, however, the error can occur in a more
common code path (which is how the bug was found).

The logic here is "we want final iput() to free inode *now* instead of
letting it sit in cache if fs is going down or had not quite come up".  The
problem is with kswapd seeing such inodes in the middle of being killed and
happily taking over.

The clean solution would be to tell kswapd to leave those inodes alone and
let our final iput deal with them.  I.e.  add a new flag
(I_FORCED_FREEING), set it before write_inode_now() there and make
prune_icache() leave those alone.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/inode.c
include/linux/fs.h