From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Stoiko Ivanov <s.ivanov@proxmox.com>
Subject: [pve-devel] applied: Re: [PATCH common 1/1] sync_mountpoint: open path so that sync works
Date: Fri, 18 Sep 2020 12:01:03 +0200 [thread overview]
Message-ID: <228f90ec-5850-379d-d4e4-da2e57e45c83@proxmox.com> (raw)
In-Reply-To: <20200917191701.2236-2-s.ivanov@proxmox.com>
On 9/17/20 9:17 PM, Stoiko Ivanov wrote:
> 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 <s.ivanov@proxmox.com>
> ---
> src/PVE/Tools.pm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
applied, thanks! Followed up with a change in error propagation, after checking
the call sites (which is only one).
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 7eb1197..7d33683 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1434,9 +1434,12 @@ sub fsync($) {
sub sync_mountpoint {
my ($path) = @_;
sysopen my $fd, $path, O_RDONLY|O_CLOEXEC or die "failed to open $path: $!\n";
- my $result = syncfs(fileno($fd));
+ my $syncfs_err;
+ if (!syncfs(fileno($fd))) {
+ $syncfs_err = "$!";
+ }
close($fd);
- return $result;
+ die "syncfs '$path' failed - $syncfs_err\n" if defined $syncfs_err;
}
# support sending multi-part mail messages with a text and or a HTML part
next prev parent reply other threads:[~2020-09-18 10:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 19:16 [pve-devel] [PATCH common/container] fix syncfs usage for snapshot backup Stoiko Ivanov
2020-09-17 19:17 ` [pve-devel] [PATCH common 1/1] sync_mountpoint: open path so that sync works Stoiko Ivanov
2020-09-18 10:01 ` Thomas Lamprecht [this message]
2020-09-17 19:17 ` [pve-devel] [PATCH container 1/1] sync_container_namespace: skip virtual filesystems Stoiko Ivanov
2020-09-18 10:07 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=228f90ec-5850-379d-d4e4-da2e57e45c83@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.ivanov@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.