[PATCH] open_namei() braindamage Re: NODEV filesystem, multiple

Alexander Viro (viro@math.psu.edu)
Wed, 14 Mar 2001 16:41:05 -0500 (EST)


On Wed, 14 Mar 2001, Petr Vandrovec wrote:

> Hey, it is reproducible:
>
> mount -t vfat /dev/hda1 /dos/c
> mount --bind / /xxx
> echo "a" > /xxx/dos/c
>
> and it stops here... ^C does not work. umount /dos/c fixes it
> (creat() returns EISDIR)

Very interesting. <thinks>
OK, so path_walk() gives us (vfsmnt of /xxx, dentry of /dos).
Then we do down() on ->i_sem of inode of /dos. OK.
We find dentry of /dos/c (mountpoint)
It's positive, so we drop ->i_sem of parent.
Dentry is a mountpoint.
We call __follow_down(). Since nothing is mounted under xxx we get
unchanged... What the fuck?

OK, I'm an idiot. Linus, please apply the following:

--- fs/namei.c.old Wed Mar 14 16:37:45 2001
+++ fs/namei.c Wed Mar 14 16:38:23 2001
@@ -1013,7 +1013,7 @@
error = -ELOOP;
if (flag & O_NOFOLLOW)
goto exit_dput;
- do __follow_down(&nd->mnt,&dentry); while(d_mountpoint(dentry));
+ while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
}
error = -ENOENT;
if (!dentry->d_inode)

Cheers,
Al

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