]> git.proxmox.com Git - pve-container.git/commit - src/PVE/LXC.pm
deal with a check_mount_path race condition
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 1 Jun 2016 07:44:51 +0000 (09:44 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 1 Jun 2016 09:25:10 +0000 (11:25 +0200)
commitab3722b36280d3ea0f522d491cebd45d22b3ffe8
tree95c02e3dbb00a69f0ff66d42027cac27a9dd5809
parent7e0e7f38c95e3283ed1f8644db238d592bf5b8e4
deal with a check_mount_path race condition

While the container itself might not be running and cannot
influence the mounting between check_mount_path() and
mount(), this is a possibility when multiple containers
have write access to the same recursive bind mount
hierarchy.

This patch adds a walk_tree_nofollow() function performing
two things: It walks a path from a starting point following
no symlinks and erroring if it encounters one. And if
requested creates all the missing directories.
This replaces both the combination of check_mount_path() and
mkpath(), and the check_mount_path() in bindmount() while
giving the latter the ability to also access the "last
component" of the path via openat() a second time after
mounting (as an alternative to also including an fstatat()
syscall) in order to verify the path which was ultimately
mounted is indeed the path walked in the first check.
src/PVE/LXC.pm