Bug 1798 - Add fsync() support to sftp/sftp-server
Summary: Add fsync() support to sftp/sftp-server
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp-server (show other bugs)
Version: -current
Hardware: All All
: P2 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_6_5
  Show dependency treegraph
 
Reported: 2010-07-16 09:56 AEST by Iain Morgan
Modified: 2016-08-02 10:42 AEST (History)
4 users (show)

See Also:


Attachments
Initial implementation of the fsync@openssh.com extension (14.51 KB, patch)
2010-07-16 09:56 AEST, Iain Morgan
no flags Details | Diff
Correct return code from do_fsync() when server does not support the extension (14.51 KB, patch)
2010-07-20 05:36 AEST, Iain Morgan
no flags Details | Diff
Updated patch vs -current (14.21 KB, patch)
2011-07-16 06:44 AEST, Iain Morgan
no flags Details | Diff
Updated to -current (17.44 KB, patch)
2013-10-11 14:23 AEDT, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Morgan 2010-07-16 09:56:50 AEST
Created attachment 1898 [details]
Initial implementation of the fsync@openssh.com extension

In some cases the delay between when a file has been transferred and
when the operating system actually flushes data to disk may provide an
opportunity for file loss or corruption. To address this, it would
be useful to call fsync(2) after writing a file.

The attached patch adds an fsync@openssh.com extension to sftp-server
which can be used to request that fsync(2) be called. In addition, a
-f option has been added to get/put and to the sftp command-line itself
to request local or remote fsync(2) of the written file.
Comment 1 Damien Miller 2010-07-19 13:22:23 AEST
The diff looks good, I'll add this to the list for V_5_6
Comment 2 Iain Morgan 2010-07-20 05:36:40 AEST
Created attachment 1905 [details]
Correct return code from do_fsync() when server does not support the extension
Comment 3 Damien Miller 2010-08-03 15:41:05 AEST
We are freezing for the OpenSSH 5.6 release. Retargetting these bugs to the next release.
Comment 4 Damien Miller 2011-01-24 12:30:52 AEDT
Retarget unclosed bugs from 5.7=>5.8
Comment 5 Iain Morgan 2011-07-16 06:44:59 AEST
Created attachment 2065 [details]
Updated patch vs -current
Comment 6 Damien Miller 2011-09-06 10:34:22 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 7 Damien Miller 2011-09-06 10:36:33 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 8 Damien Miller 2011-09-06 10:39:09 AEST
Retarget unresolved bugs/features to 6.0 release

(try again - bugzilla's "change several" isn't)
Comment 9 Damien Miller 2012-02-24 10:34:31 AEDT
Retarget from 6.0 to 6.1
Comment 10 Damien Miller 2012-02-24 10:38:10 AEDT
Retarget 6.0 => 6.1
Comment 11 Damien Miller 2012-09-07 11:38:22 AEST
Retarget uncompleted bugs from 6.1 => 6.2
Comment 12 Damien Miller 2012-09-07 11:40:46 AEST
Retarget bugs from 6.1 => 6.2
Comment 13 Damien Miller 2013-03-08 10:24:13 AEDT
retarget to openssh-6.3
Comment 14 Richard W.M. Jones 2013-04-09 00:05:02 AEST
I just came across this proposed extension of sftp in
OpenSSH, and it's something that we could really use
in order to make qemu ssh block device safe:

http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg01118.html
Comment 15 Richard W.M. Jones 2013-04-09 19:43:41 AEST
I have now added support to libssh2 to support this call, and
also tested that it works (it does).

http://www.libssh2.org/mail/libssh2-devel-archive-2013-04/0007.shtml
http://www.libssh2.org/mail/libssh2-devel-archive-2013-04/0006.shtml
Comment 16 Damien Miller 2013-07-25 12:18:12 AEST
Retarget to openssh-6.4
Comment 17 Damien Miller 2013-07-25 12:21:14 AEST
Retarget 6.3 -> 6.4
Comment 18 Richard W.M. Jones 2013-07-25 18:16:16 AEST
Why does this keep getting delayed?  Why not just add the patch?

It's a simple & useful feature which would allow qemu to use
OpenSSH.
Comment 19 Damien Miller 2013-10-11 14:23:14 AEDT
Created attachment 2351 [details]
Updated to -current

Revised patch, with description of extension in the PROTOCOL file.

Hopefully I'll be able to get it in this time. I wasn't able to convince everyone that it was worth the DoS risk before (many platforms implement fsync() by just calling the fs-wide sync() function which can trigger a lot of I/O), but now we have the request blacklist that can avoid this in cases where users can't be trusted.
Comment 20 Daniel Black 2013-10-11 15:32:06 AEDT
small doco error in PROTOCOL

339		string		"hardlink@openssh.com"
Comment 21 Damien Miller 2013-10-17 11:30:30 AEDT
Committed - this will be in OpenSSH 6.4. Thanks!
Comment 22 Damien Miller 2016-08-02 10:42:50 AEST
Close all resolved bugs after 7.3p1 release