block: add trace point when fdatasync fails

A flush failure is a critical failure scenario for some operations.
For example, it will prevent migration from completing, as it will
make vm_stop() report an error. Thus it is important to have a
trace point present for debugging.

Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-04-15 14:28:16 +01:00
parent c7ddc8821d
commit 60ff2ae2a2
2 changed files with 3 additions and 0 deletions

View File

@ -1338,6 +1338,8 @@ static int handle_aiocb_flush(void *opaque)
ret = qemu_fdatasync(aiocb->aio_fildes); ret = qemu_fdatasync(aiocb->aio_fildes);
if (ret == -1) { if (ret == -1) {
trace_file_flush_fdatasync_failed(errno);
/* There is no clear definition of the semantics of a failing fsync(), /* 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 * 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 * assumption is correct for Linux. Some pages are now probably marked

View File

@ -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_FindEjectableOpticalMedia(const char *media) "Matching using %s"
file_setup_cdrom(const char *partition) "Using %s as optical disc" 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_hdev_is_sg(int type, int version) "SG device found: type=%d, version=%d"
file_flush_fdatasync_failed(int err) "errno %d"
# ssh.c # 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)" 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)"