lkml.org 
[lkml]   [1998]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subjectwarning patch for 2.1.120 dcache.c
    I've recently tracked down a couple of bugs thanks to some warning
    tests I added in the dcache code, and think it would be very helpful to
    include these in the kernel as 2.1 enters its final testing.

    One check is for an unhashed target in d_move(), which can have the
    distinctly unwanted surprise of unhashing the source dentry after a
    move. This is due to the tricky way the source dentry switches hashes by
    linking following the target node. This test just triggered while
    stress-testing the msdos fs, after which a FAT panic followed.

    The other check is in d_instantiate(), which normally is called to make
    a negative dentry positive, but could be called on a non-negative dentry
    to result in a dentry leak. There's also a place in the msdos rename
    code where the inodes are switched, but the dentry is unlinked from the
    alias list first.

    Regards,
    Bill--- linux-2.1.120/fs/dcache.c.old Tue Sep 1 21:40:17 1998
    +++ linux-2.1.120/fs/dcache.c Mon Sep 7 19:34:41 1998
    @@ -555,11 +606,15 @@
    * (or otherwise set) by the caller to indicate that it is now
    * in use by the dcache..
    */
    -void d_instantiate(struct dentry *entry, struct inode * inode)
    +void d_instantiate(struct dentry *dentry, struct inode * inode)
    {
    + if (dentry->d_inode && !list_empty(&dentry->d_alias))
    + printk(KERN_ERR "d_instantiate: %s/%s not negative!\n",
    + dentry->d_parent->d_name.name, dentry->d_name.name);
    +
    if (inode)
    - list_add(&entry->d_alias, &inode->i_dentry);
    - entry->d_inode = inode;
    + list_add(&dentry->d_alias, &inode->i_dentry);
    + dentry->d_inode = inode;
    }

    struct dentry * d_alloc_root(struct inode * root_inode, struct dentry *old_root)
    @@ -744,6 +804,8 @@
    {
    if (!dentry->d_inode)
    printk(KERN_WARNING "VFS: moving negative dcache entry\n");
    + if (list_empty(&target->d_hash))
    + printk(KERN_WARNING "VFS: target dentry not hashed\n");

    /* Move the dentry to the target hash queue */
    list_del(&dentry->d_hash);
    \
     
     \ /
      Last update: 2005-03-22 13:44    [W:0.046 / U:64.356 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site