• Dipankar Sarma's avatar
    [PATCH] Fix dcache lookup · 61f969b4
    Dipankar Sarma authored
    __d_lookup() has leftover stuff from earlier code to protect it against
    rename.  The smp_rmb() there was needed for the sequence counter logic.
    
    Original dcache_rcu had :
    
    +               move_count = dentry->d_move_count;
    +               smp_rmb();
    +
                    if (dentry->d_name.hash != hash)
                            continue;
                    if (dentry->d_parent != parent)
                            continue;
    
    This was to make sure that comparisons didn't happen before before the
    sequence counter was snapshotted.  This logic is now gone and memory
    barrier is not needed.  Removing this should also improve performance.
    
    The other change is the leftover smp_read_barrier_depends(), later
    converted to rcu_dereference().  Originally, the name comparison was not
    protected against d_move() and there could have been a mismatch of
    allocation size of the name string and dentry->d_name.len.  This was
    avoided by making the qstr update in dentry atomic using a d_qstr pointer. 
    Now, we do ->d_compare() or memcmp() with the d_lock held and it is safe
    against d_move().  So, there is no need to rcu_dereference() anything.  In
    fact, the current code is meaningless.
    Signed-off-by: default avatarDipankar Sarma <dipankar@in.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    61f969b4
dcache.c 41.2 KB