[Lustre-discuss] __d_rehash and __d_move in ldiskfs in 1.6.5.1 w/ RHEL4 latest security-patch kernel rev 2.6.9-67.0.22

Chris Worley worleys at gmail.com
Thu Jul 31 20:03:26 PDT 2008


The 1.6.5.1 rhel5 patches patched w/o reject, but, when the ldiskfs
module loads, there are two undefined externls: __d_rehash, and
__d_move.  These are in fs/dcache.c in the kernel.

For __d_rehash their look to be two easy fixes:

1) expose the  static __d_rehash function, or
2) have ldiskfs call d_cond_refresh instead (ldiskfs always calls
__d_rehash with "0" as the second arg.

Which is correct?

The function definitions are:

static void __d_rehash(struct dentry * entry, struct hlist_head *list)
{

        entry->d_flags &= ~DCACHE_UNHASHED;
        entry->d_bucket = list;
        hlist_add_head_rcu(&entry->d_hash, list);
}

...and ...

void d_rehash_cond(struct dentry * entry, int lock)
{
        struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);

        if (lock)
                spin_lock(&dcache_lock);
        spin_lock(&entry->d_lock);
        entry->d_flags &= ~DCACHE_UNHASHED;
        spin_unlock(&entry->d_lock);
        entry->d_bucket = list;
        hlist_add_head_rcu(&entry->d_hash, list);
        if (lock)
                spin_unlock(&dcache_lock);
}

The second issue is "__d_move".  The likely fix here is to have
ldiskfs call the already exposed "d_move" instead:

void d_move(struct dentry * dentry, struct dentry * target)
{
        spin_lock(&dcache_lock);
        d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
}

Would that be correct?

Thanks,

Chris



More information about the lustre-discuss mailing list