Commit:     4c1fe2f78a08e2c514a39c91a0eb7b55bbd3c0d2
Parent:     eda4f9b7996e5520934ca2a7310b363463a4e3b0
Author:     Neil Brown <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 1 16:50:20 2007 +1100
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Sat Nov 17 13:08:48 2007 -0500

    kernel BUG at fs/nfs/namespace.c:108! - can be triggered by bad server
    Hi Trond,
    I have discovered that the BUG_ON in nfs_follow_mountpoint:
    can be triggered by a misbehaving server.
    What happens is the client does a lookup and discoveres that the named
    directory has a different fsid, so it initiates a mount.
    It then performs a GETATTR on the mounted directory and gets a
    different fsid again (due to a bug in the NFS server).
    This causes nfs_follow_mountpoint to be called on the newly mounted
    root, which triggers the BUG_ON.
    To duplicate this, have a directory which contains some mountpoints,
    and export that directory with the "crossmnt" flag using nfs-utils
    1.1.1 (or 1.1.0 I think)
    The GETATTR on the root of the mounted filesystem will return the
    information for the top exportpoint, while a lookup will return the
    correct information.  This difference causes the NFS client to BUG.
    I think the best way to fix this is to trap this possibility early, so
    just before completing the mount in the NFS client, check that it isn't
    going to use nfs_mountpoint_inode_operations.
    As long as i_op will never change once set (is that true?), this
    should be adequately safe.
    The following patch shows a possible approach, and it works for me.
    i.e. when the NFS server is misbehaving, I get ESTALE on those
    mountpoints, while when the NFS server is working correctly, I get
    correct behaviour on the client.
    Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
 fs/nfs/super.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fa517ae..71067d1 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1474,6 +1474,11 @@ static int nfs_xdev_get_sb(struct file_system_type 
*fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
+       if (mntroot->d_inode->i_op != &nfs_dir_inode_operations) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to