Skip to content

Commit 295dc39

Browse files
VasilyAverinChristoph Hellwig
authored and
Christoph Hellwig
committed
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>
1 parent 6fcc542 commit 295dc39

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: fs/namei.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2256,9 +2256,10 @@ mountpoint_last(struct nameidata *nd, struct path *path)
22562256
goto out;
22572257
}
22582258
path->dentry = dentry;
2259-
path->mnt = mntget(nd->path.mnt);
2259+
path->mnt = nd->path.mnt;
22602260
if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW))
22612261
return 1;
2262+
mntget(path->mnt);
22622263
follow_mount(path);
22632264
error = 0;
22642265
out:

0 commit comments

Comments
 (0)