| ★ wanayoo — archive 1999 http://www.kernelnotes.org/patch/21-p0765.html | Nouvelle recherche | Portail wanayoo |
|
Bill Hawes (whawes@star.net) Sun Aug 10 23:14:00 1997 |
[Home] [Linux 2.0] [Linux 2.1] [Information] [Software] [Distributions] [Links] |
|
It seems that the kswapd oops bug is still extant, so I checked some more and found a race in d_move that could account for the problem. The call to d_remove_from_parent() dputs the parent dentry, and a call to alloc_new_name is made before the new parent pointer is installed. If alloc_new_name has to get more memory, it could start the kswapd process, and a shrink_dcache could then catch the dentry with a stale parent pointer, leading to the oops.The attached patch fixes this by replacing d_remove_from_parent with d_drop, followed by saving the old parent and installing the new. The (possibly blocking) dput is deferred until the dentry is hashed into the new parent.
I've also incorporated the changes to fs/dcache.c and fs/namei.c following our discussion yesterday. Dentries are now delivered from d_alloc with d_count = 1 and a valid parent pointer -- either self or a dget(parent). This keeps the dentry safe for the duration of the fs lookup, and real_lookup now delivers the dentry with the use count already incremented.
One further improvement I'd like to see would be to pass a reference to d_move of a dentry with the new name. It could then just swap names in the dentries instead of having to allocate. Does this seem reasonable?