projects
/
pve-common.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dde69c3
)
added syncfs syscall and sync_mountpoint helper
author
Wolfgang Bumiller
<w.bumiller@proxmox.com>
Thu, 11 Feb 2016 08:26:29 +0000
(09:26 +0100)
committer
Dietmar Maurer
<dietmar@proxmox.com>
Thu, 11 Feb 2016 10:24:11 +0000
(11:24 +0100)
src/PVE/Tools.pm
patch
|
blob
|
blame
|
history
diff --git
a/src/PVE/Tools.pm
b/src/PVE/Tools.pm
index 60ba8aa5f62d01892ed2fd9189c77141d34ca74e..6303d2047f5fc02898feb553321336c702710a2c 100644
(file)
--- a/
src/PVE/Tools.pm
+++ b/
src/PVE/Tools.pm
@@
-75,6
+75,8
@@
use constant {CLONE_NEWNS => 0x00020000,
CLONE_NEWPID => 0x20000000,
CLONE_NEWNET => 0x40000000};
+use constant O_PATH => 0x10000000;
+
sub run_with_timeout {
my ($timeout, $code, @param) = @_;
@@
-1195,4
+1197,17
@@
sub setns($$) {
return 0 == syscall(308, $fileno, $nstype);
}
+sub syncfs($) {
+ my ($fileno) = @_;
+ return 0 == syscall(306, $fileno);
+}
+
+sub sync_mountpoint {
+ my ($path) = @_;
+ sysopen my $fd, $path, O_PATH or die "failed to open $path: $!\n";
+ my $result = syncfs(fileno($fd));
+ close($fd);
+ return $result;
+}
+
1;