2006-03-09 13:59:47

by Jan Blunck

[permalink] [raw]
Subject: [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory() race (2nd updated patch)

This is an updated version of the patch which adresses some issues that came
up during discussion.

Although sb->s_prunes usually is zero, I'm testing it now before calling
wake_up(). Besides that, the shrink_dcache_parent() is only waiting for prunes
if we are called through generic_shutdown_super() when sb->s_root is NULL.
Recently updated the comments to be more verbose about the goals of the
modification.

Original patch description:

Kirill Korotaev <[email protected]> discovered a race between shrink_dcache_parent()
and shrink_dcache_memory() which leads to "Busy inodes after unmount".
When unmounting a file system shrink_dcache_parent() is racing against a
possible shrink_dcache_memory(). This might lead to the situation that
shrink_dcache_parent() is returning too early. In this situation the
super_block is destroyed before shrink_dcache_memory() could put the inode.

This patch fixes the problem through introducing a prunes counter which is
incremented when a dentry is pruned but the corresponding inoded isn't put
yet.When the prunes counter is not null, shrink_dcache_parent() is waiting and
restarting its work.

Signed-off-by: Jan Blunck <[email protected]>


Attachments:
(No filename) (1.15 kB)
umount-prune_one_dentry-fix.diff (4.59 kB)
Download all attachments