Re: [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory()race (3rd updated patch)]

From: Neil Brown
Date: Fri Mar 10 2006 - 06:59:51 EST


On Friday March 10, dev@xxxxx wrote:
> just an idea which came to my mind:
> can't we fix it the following way:
> 1. fix select_parent() when called from generic_shutdown_super() to loop
> until _all_ dentries are shrinked (not only those, with d_count = 1);
> this guarentees that no dentries are left.

You couldn't just busy-wait. You would need to have some wait_queue
to wait on, and someone to wake it up.


> 2. no dentries are left, but iput() can be in progress.
> So can't we simply make invalidate_inodes() to be in a loop with
> schedule() until no busy inodes are left?!

Again, you need to be more predictable than just calling schedule().

>
> unregister_netdevice() for example, loops until netdev counter drops to
> zero. Why can't we do it the same way? Any objections?

I'd really like to understand why the code was the way it is before
making that sort of change. It could just be that there was nothing
obvious to wait on, so maybe just adding a suitable wait_queue would
do it...
But then the current patch essentially adds a wait_queue and waits on
it where appropriate. So would you approach be that much cleaner?
Maybe...

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/