• Andrew Morton's avatar
    [PATCH] real_lookup race fix · 1b8910cf
    Andrew Morton authored
    From: Maneesh Soni <maneesh@in.ibm.com>
    
    Here is a patch to use seqlock for real_lookup race with d_lookup as suggested
    by Linus. The race condition can result in duplicate dentry when d_lookup
    fails due concurrent d_move in some unrelated directory.
    
    Apart from real_lookup, lookup_hash()->cached_lookup() can also fail due
    to same reason. So, for that I am doing the d_lookup again.
    
    Now we have __d_lookup (called from do_lookup() during pathwalk) and
    d_lookup which uses seqlock to protect againt rename race.
    
    dcachebench numbers (lower is better) don't have much difference on a 4-way
    PIII xeon SMP box.
    
    base-2565
    Average usec/iteration  19059.4
    Standard Deviation      503.07
    
    base-2565 + seq_lock
    Average usec/iteration  18843.2
    Standard Deviation      450.57
    1b8910cf
namei.c 53.2 KB