qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v8 2/3] block: ssh: Use libssh2_sftp_fsync (if supported by libssh2) to flush to disk.
Date: Tue, 9 Apr 2013 14:47:14 +0200	[thread overview]
Message-ID: <20130409124714.GA12782@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1365501393-5010-3-git-send-email-rjones@redhat.com>

On Tue, Apr 09, 2013 at 10:56:32AM +0100, Richard W.M. Jones wrote:

These are both not worth respinning for, but just in case you send
another version.

> +static coroutine_fn int ssh_flush(BDRVSSHState *s)
> +{
> +    int r;
> +    static int warned = 0;
> +
> +    DPRINTF("fsync");
> + again:
> +    r = libssh2_sftp_fsync(s->sftp_handle);
> +    if (r == LIBSSH2_ERROR_EAGAIN || r == LIBSSH2_ERROR_TIMEOUT) {
> +        co_yield(s);
> +        goto again;
> +    }
> +    if (r == LIBSSH2_ERROR_SFTP_PROTOCOL &&
> +        libssh2_sftp_last_error(s->sftp) == LIBSSH2_FX_OP_UNSUPPORTED) {
> +        if (!warned) {
> +            error_report("warning: remote ssh server does not support fsync");

Perhaps not worth fixing but this error message has two properties which
could be improved:

1. When multiple -drive file=ssh:// are used it is unclear which SSH
   server lacks fsync support since the error message does not say.

2. When multiple -drive file=ssh:// are used only the first server
   lacking support will print a warning since warned is static.

> diff --git a/qemu-doc.texi b/qemu-doc.texi
> index 7a0f373..9e30667 100644
> --- a/qemu-doc.texi
> +++ b/qemu-doc.texi
> @@ -1072,12 +1072,6 @@ the standard ssh port (22) is used.
>  Currently authentication must be done using ssh-agent.  Other
>  authentication methods may be supported in future.
>  
> -Note: The ssh driver does not obey disk flush requests (ie. to commit
> -data to the backing disk when the guest requests it).  This is because
> -the underlying protocol (SFTP) does not support this.  Thus there is a
> -risk of guest disk corruption if the remote server or network goes
> -down during writes.

We can expect many SSH servers not to support the fsync extension.  It
would be best to include a note explaining that fsync is not available
on older ssh servers and therefore data integrity cannot be guaranteed
in those cases.

Stefan

  reply	other threads:[~2013-04-09 12:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09  9:56 [Qemu-devel] [PATCH v8 0/3] block: Add support for Secure Shell (ssh) block device Richard W.M. Jones
2013-04-09  9:56 ` [Qemu-devel] [PATCH v8 1/3] " Richard W.M. Jones
2013-04-09  9:56 ` [Qemu-devel] [PATCH v8 2/3] block: ssh: Use libssh2_sftp_fsync (if supported by libssh2) to flush to disk Richard W.M. Jones
2013-04-09 12:47   ` Stefan Hajnoczi [this message]
2013-04-09 13:04     ` Richard W.M. Jones
2013-04-09  9:56 ` [Qemu-devel] [PATCH v8 3/3] iotests: Add 'check -ssh' option to test Secure Shell block device Richard W.M. Jones
2013-04-09 13:05 ` [Qemu-devel] [PATCH v8 0/3] block: Add support for Secure Shell (ssh) " Stefan Hajnoczi
2013-10-17  8:19 ` Richard W.M. Jones
2013-10-18 10:55   ` Stefan Hajnoczi

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=20130409124714.GA12782@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).