aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-06-14 15:59:13 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-06-14 15:59:13 +0100
commit1ea06abceec61b6f3ab33dadb0510b6e09fb61e2 (patch)
tree4b76a98d9104f81de9d8b337e470eacd1e04dfe5 /block
parentfbe7919ecee8d525ccd107027d73d877cd4eccc4 (diff)
parent970bc16f60937bcfd334f14c614bd4407c247961 (diff)
downloadqemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.zip
qemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.tar.gz
qemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.tar.bz2
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/misc-fixes-pull-request' into staging
Merge misc patches # gpg: Signature made Mon 14 Jun 2021 15:14:48 BST # gpg: using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full] # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" [full] # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange-gitlab/tags/misc-fixes-pull-request: usb/dev-mtp: use GDateTime for formatting timestamp for objects block: use GDateTime for formatting timestamp when dumping snapshot info migration: use GDateTime for formatting timestamp in snapshot names block: remove duplicate trace.h include block: add trace point when fdatasync fails block: preserve errno from fdatasync failures softmmu: add trace point when bdrv_flush_all fails migration: add trace point when vm_stop_force_state fails sasl: remove comment about obsolete kerberos versions docs: recommend SCRAM-SHA-256 SASL mech instead of SHA-1 variant docs: document usage of the authorization framework docs: document how to pass secret data to QEMU docs: add table of contents to QAPI references Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r--block/file-posix.c10
-rw-r--r--block/qapi.c11
-rw-r--r--block/trace-events1
3 files changed, 10 insertions, 12 deletions
diff --git a/block/file-posix.c b/block/file-posix.c
index f37dfc1..b3fbb9b 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -106,8 +106,6 @@
#include <xfs/xfs.h>
#endif
-#include "trace.h"
-
/* OS X does not have O_DSYNC */
#ifndef O_DSYNC
#ifdef O_SYNC
@@ -160,7 +158,7 @@ typedef struct BDRVRawState {
bool discard_zeroes:1;
bool use_linux_aio:1;
bool use_linux_io_uring:1;
- bool page_cache_inconsistent:1;
+ int page_cache_inconsistent; /* errno from fdatasync failure */
bool has_fallocate;
bool needs_alignment;
bool drop_cache;
@@ -1333,11 +1331,13 @@ static int handle_aiocb_flush(void *opaque)
int ret;
if (s->page_cache_inconsistent) {
- return -EIO;
+ return -s->page_cache_inconsistent;
}
ret = qemu_fdatasync(aiocb->aio_fildes);
if (ret == -1) {
+ trace_file_flush_fdatasync_failed(errno);
+
/* There is no clear definition of the semantics of a failing fsync(),
* so we may have to assume the worst. The sad truth is that this
* assumption is correct for Linux. Some pages are now probably marked
@@ -1352,7 +1352,7 @@ static int handle_aiocb_flush(void *opaque)
* Obviously, this doesn't affect O_DIRECT, which bypasses the page
* cache. */
if ((s->open_flags & O_DIRECT) == 0) {
- s->page_cache_inconsistent = true;
+ s->page_cache_inconsistent = errno;
}
return -errno;
}
diff --git a/block/qapi.c b/block/qapi.c
index dc69341..cf557e3 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -663,10 +663,8 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
{
- char date_buf[128], clock_buf[128];
+ char clock_buf[128];
char icount_buf[128] = {0};
- struct tm tm;
- time_t ti;
int64_t secs;
char *sizing = NULL;
@@ -674,10 +672,9 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
qemu_printf("%-10s%-17s%8s%20s%13s%11s",
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK", "ICOUNT");
} else {
- ti = sn->date_sec;
- localtime_r(&ti, &tm);
- strftime(date_buf, sizeof(date_buf),
- "%Y-%m-%d %H:%M:%S", &tm);
+ g_autoptr(GDateTime) date = g_date_time_new_from_unix_local(sn->date_sec);
+ g_autofree char *date_buf = g_date_time_format(date, "%Y-%m-%d %H:%M:%S");
+
secs = sn->vm_clock_nsec / 1000000000;
snprintf(clock_buf, sizeof(clock_buf),
"%02d:%02d:%02d.%03d",
diff --git a/block/trace-events b/block/trace-events
index 574760b..b3d2b1e 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -206,6 +206,7 @@ file_copy_file_range(void *bs, int src, int64_t src_off, int dst, int64_t dst_of
file_FindEjectableOpticalMedia(const char *media) "Matching using %s"
file_setup_cdrom(const char *partition) "Using %s as optical disc"
file_hdev_is_sg(int type, int version) "SG device found: type=%d, version=%d"
+file_flush_fdatasync_failed(int err) "errno %d"
# ssh.c
sftp_error(const char *op, const char *ssh_err, int ssh_err_code, int sftp_err_code) "%s failed: %s (libssh error code: %d, sftp error code: %d)"