lkml.org 
[lkml]   [1999]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: dcache problems with vfat
    Alexander Viro writes:
    > All this aliases-related stuff looks ugly.

    No kidding. In 2.0.x, the alias stuff was pretty easy. With the
    dentry code in 2.1.x, it got much uglier, and it took me from about
    2.1.70 to 2.1.115 to get all/most of the bugs worked out. Bill Hawes
    and I spent quite a bit of time tracking down various inode/dentry
    problems related to fat/vfat. Thankfully, Bill is a master of dentry
    and inode problems and was able to make sense of things.

    >Try
    >
    > $ mkdir a.long
    > $ cd a~1.lon
    > $ mkdir b
    > $ cd b
    > $ mv ../../a.long .
    >
    > ... and watch the fun.

    Urghh. Yes, the checking if something is your parent is no longer using
    inodes so it should also be checking aliases. Here is an untested bit of
    code that tried to deal with this problem. It might not patch perfectly--
    I created the patch of 2.1.131--but it should give the idea of what
    I'm trying to do.

    --- fs/vfat/namei.c~ Tue Dec 1 23:52:55 1998
    +++ fs/vfat/namei.c Wed Jan 6 01:13:27 1999
    @@ -1639,6 +1639,26 @@
    return res;
    }

    +int vfat_equiv(struct dentry *dentry1, struct dentry *dentry2)
    +{
    + struct list_head *head, *tmp;
    + struct dentry *alias;
    +
    + if (dentry1 == dentry2) return 1;
    +
    + head = &dentry1->d_inode->i_dentry;
    + if (dentry1->d_inode) {
    + tmp = dentry1->d_inode->i_dentry.next;
    + while (tmp != head) {
    + alias = list_entry(tmp, struct dentry, d_alias);
    + if (alias == dentry2)
    + return 1;
    + next = tmp->next;
    + }
    + }
    + return 0;
    +}
    +
    int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
    struct inode *new_dir,struct dentry *new_dentry)
    {
    @@ -1690,7 +1710,7 @@
    walk = new_dentry;
    /* prevent moving directory below itself */
    for (;;) {
    - if (walk == old_dentry) return -EINVAL;
    + if (vfat_equiv(walk, old_dentry)) return -EINVAL;
    if (walk == walk->d_parent) break;
    walk = walk->d_parent;
    }

    > Gordon, do we *really* need to be able to open something by short
    > name? They introduce quite a lot of mess. BTW, example above "worked" the
    > same way before changes in 131.

    Yes, we really do need to be able to access by short names. Things like
    Wine depend on them. I have a test suite that can be found at
    http://bmrc.berkeley.edu/people/chaffee/vfat.html

    It runs some alias tests like the above. I just added the above test
    to my own copy of the suite (not the one of the web site).

    - Gordon

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:49    [W:2.514 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site