Kernel: resolving /var in mount(2)
Kernel: resolving /var in mount(2)
- Subject: Kernel: resolving /var in mount(2)
- From: Jorgen Lundman <email@hidden>
- Date: Mon, 13 Jul 2015 17:00:22 +0900
Hello list,
I'm not entirely convinced it is worth mentioning this issue, but we came
across something peculiar with symlink resolve.
In our code, we will eventually call "mount(2)" to trigger a mount:
printf("Used path is '%s'\n", dir);
rv = mount(fstype, dir, 0, &mnt_args);
and in our vfs_mount() handler, print out:
zfs_vfs_mount(struct mount *vfsp, vnode_t *mvp /*devvp*/,
user_addr_t data, vfs_context_t context)
{
printf("mount toname is '%s'\n", vfs_statfs(vfsp)->f_mntonname);
and this situation happens:
Used path is '/var/tmp/child_dir'
mount toname is 'private/var/tmp/child_dir'
So, somewhere internally it attempts to resolve symlinks before calling
VFS_MOUNT, possibly the NDINIT/namei calls done in __mac_mount(). But in
doing so, drops the leading slash in "/private".
Unfortunately, I am not allowed to call NDINIT/namei so I can't confirm it.
Interestingly, both mount(8) and "diskutil mount" call realpath() before
mount(2) so they never have the issue, and we will follow their lead. But
something under the hood here isn't quite right. But we will move forward
and not look back :)
Lund
--
Jorgen Lundman | <email@hidden>
Unix Administrator | +81 (0)90-5578-8500 (work)
Shibuya-ku, Tokyo | +81 (0)80-2090-5800 (cell)
Japan | +81 (0)3 -3375-1767 (home)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden