Skip to content

Commit 295dc39

Browse files
VasilyAverinChristoph Hellwig
authored andcommitted
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 <[email protected]> Acked-by: Ian Kent <[email protected]> Acked-by: Jeff Layton <[email protected]> Cc: [email protected] Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 6fcc542 commit 295dc39

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/namei.c

Lines changed: 2 additions & 1 deletion
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)