www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).

Re: [PATCH] sftp: Add support for fsync (OpenSSH extension).

From: Richard W.M. Jones <rjones_at_redhat.com>
Date: Tue, 9 Apr 2013 15:23:45 +0100

On Tue, Apr 09, 2013 at 04:16:58PM +0200, Daniel Stenberg wrote:
> On Tue, 9 Apr 2013, Richard W.M. Jones wrote:
>
> >*NOTE:* For this to work you will need a patched OpenSSH with an
> >accepted-upstream-but-not-included patch that adds the
> >fsync_at_openssh.com extension to OpenSSH sftp-server.
>
> Very cool! I'll merge this asap.
>
> I'm curious though, what exactly happens if you try this on a
> non-supporting SFTP server? Can we make that fail in a nice way?

Yes, very much so, that's important to us because lots of
servers will not support fsync for a long time to come.

In this case, it fails as follows:

/* extract from the latest qemu ssh block driver code */
    r = libssh2_sftp_fsync(s->sftp_handle);
/* ... */
    if (r == LIBSSH2_ERROR_SFTP_PROTOCOL &&
        libssh2_sftp_last_error(s->sftp) == LIBSSH2_FX_OP_UNSUPPORTED) {
        unsafe_flush_warning(s, "OpenSSH >= 6.3");
        return 0;
    }

This behaviour is also documented in the libssh2_sftp_fsync man page
that I sent.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-04-09

the libssh2 team