lkml.org 
[lkml]   [2000]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: bug: mount on an open directory succeeds
    > On Mon, 06 Mar 2000, Alexander Viro wrote:
    > > On Mon, 6 Mar 2000, Amit S. Kale wrote:
    > >
    > > > Hi,
    > > > mount on an open directory succeeds.
    > >
    > > Yes, it does. WTF makes you think that it's a bug?

    it's a feature, right. but a buggy one. RTFmail a few more lines
    and you'll see why.
    the problem is in lookup_dentry()
    if a process looks up "." on a mounted directory and it was inside it before
    the mount, then
    ...
    dentry = reserved_lookup(base, &this);

    dentry = pwd of this process, the old (covered) /mnt.

    if (!dentry) {
    dentry = cached_lookup(base, &this, flags);
    if (!dentry) {
    dentry = real_lookup(base, &this, flags);
    if (IS_ERR(dentry))
    break;
    }
    }

    /* Check mountpoints.. */
    dentry = follow_mount(dentry);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    and now it's the new (mounted) /mnt.
    so ls . will show you the mounted directory, but ls -l fails because
    it's trying to stat files of the mounted directory in the covered directory.

    I've appended a tentative fix below, need to check it. look ok ?

    ganesh

    --- linux/fs/namei.c.ORG Mon Mar 6 17:10:05 2000
    +++ linux/fs/namei.c Mon Mar 6 17:10:48 2000
    @@ -403,10 +403,9 @@
    if (IS_ERR(dentry))
    break;
    }
    + /* Check mountpoints.. */
    + dentry = follow_mount(dentry);
    }
    -
    - /* Check mountpoints.. */
    - dentry = follow_mount(dentry);

    base = do_follow_link(base, dentry, flags);
    if (IS_ERR(base))
    -
    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:56    [W:0.019 / U:1.636 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site