Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: umount on symlink leaks mnt count

Currently umount on symlink blocks following umount:

/vz is separate mount

# ls /vz/ -al | grep test
drwxr-xr-x. 2 root root 4096 Jul 19 01:14 testdir
lrwxrwxrwx. 1 root root 11 Jul 19 01:16 testlink -> /vz/testdir
# umount -l /vz/testlink
umount: /vz/testlink: not mounted (expected)

# lsof /vz
# umount /vz
umount: /vz: device is busy. (unexpected)

In this case mountpoint_last() gets an extra refcount on path->mnt

Signed-off-by: Vasily Averin <vvs@openvz.org>
Acked-by: Ian Kent <raven@themaw.net>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Vasily Averin and committed by
Christoph Hellwig
295dc39d 6fcc5420

+2 -1
+2 -1
fs/namei.c
··· 2256 2256 goto out; 2257 2257 } 2258 2258 path->dentry = dentry; 2259 - path->mnt = mntget(nd->path.mnt); 2259 + path->mnt = nd->path.mnt; 2260 2260 if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) 2261 2261 return 1; 2262 + mntget(path->mnt); 2262 2263 follow_mount(path); 2263 2264 error = 0; 2264 2265 out: