sync_mountpoint takes a path, gets an open filedescriptor and calls syncfs(2) on it. by opening with O_PATH the syncfs call fails with EBADF (see open(2)).
found by running: ``` pkill -f 'pvedaemon worker'; strace -yyttT -s 512 -o /tmp/trace -fp $(pgrep -f pvedaemon$) ``` Signed-off-by: Stoiko Ivanov <[email protected]> --- src/PVE/Tools.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index e04b504..7eb1197 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -94,6 +94,7 @@ use constant {CLONE_NEWNS => 0x00020000, CLONE_NEWNET => 0x40000000}; use constant {O_PATH => 0x00200000, + O_CLOEXEC => 0x00080000, O_TMPFILE => 0x00410000}; # This includes O_DIRECTORY use constant {AT_EMPTY_PATH => 0x1000, @@ -1432,7 +1433,7 @@ sub fsync($) { sub sync_mountpoint { my ($path) = @_; - sysopen my $fd, $path, O_PATH or die "failed to open $path: $!\n"; + sysopen my $fd, $path, O_RDONLY|O_CLOEXEC or die "failed to open $path: $!\n"; my $result = syncfs(fileno($fd)); close($fd); return $result; -- 2.20.1 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
