Skip to contentSkip to conversation

open_namei() braindamage Re: NODEV filesystem, multiple mounts and umount...

PATCH New Alexander Viro 1 participant 1 message Mar 14, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 open_namei() braindamage Re: NODEV filesystem, multiple mounts and umount...

Quoted 8 lines · Petr Vandrovec

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:

namei.c Wed Mar 14 16:38:23 2001 renamed from namei.c.old Wed Mar 14 16:37:45 2001 +1 -1
@@ -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