After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771022 - Add server-side copy support
Add server-side copy support
Status: RESOLVED OBSOLETE
Product: gvfs
Classification: Core
Component: smb backend
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks: 776339
 
 
Reported: 2016-09-07 19:06 UTC by Frank
Modified: 2018-09-21 18:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
smb: Add initial remote copy support (6.29 KB, patch)
2016-09-15 10:34 UTC, Ondrej Holy
none Details | Review
smb: Run remote copy in another thread (5.31 KB, patch)
2016-09-15 10:35 UTC, Ondrej Holy
none Details | Review
smb: Add separate context for remote copying (6.16 KB, patch)
2016-09-15 10:36 UTC, Ondrej Holy
none Details | Review
smb: Add initial remote copy support (6.64 KB, patch)
2016-09-15 14:05 UTC, Ondrej Holy
none Details | Review
smb: Run remote copy in another thread (5.20 KB, patch)
2016-09-15 14:08 UTC, Ondrej Holy
none Details | Review
smb: Add separate context for remote copying (6.49 KB, patch)
2016-09-15 14:08 UTC, Ondrej Holy
none Details | Review
smb: Handle cancellation of the copy operation properly (1.09 KB, patch)
2016-09-15 14:08 UTC, Ondrej Holy
none Details | Review
smb: Add separate context for blocking operations (3.86 KB, patch)
2017-01-18 12:38 UTC, Ondrej Holy
none Details | Review
smb: Add initial remote copy support (7.88 KB, patch)
2017-01-18 12:38 UTC, Ondrej Holy
none Details | Review
backtrace (19.34 KB, text/plain)
2017-01-18 12:47 UTC, Ondrej Holy
  Details

Description Frank 2016-09-07 19:06:58 UTC
I got several shared volumes on my FreeNAS system. When I copy some files from a volume to another one on the same remote system through Nautilus (beign logged in per ssh or cifs), data transmission is done at 2 MB/s. So obviously the data is piped through my machine and back to FreeNAS. If I execute this mv/cp command on the remote shell, it is done way faster.

Would it be possible executing such commands directly on the remote machine, if both volumes are on the same host?
Comment 1 Carlos Soriano 2016-09-08 08:16:35 UTC
We just do the g_file_copy (gfile) so I believe this is gvfs
Comment 2 Ondrej Holy 2016-09-08 12:13:25 UTC
This is not indeed a problem in Nautilus. 

There is already a bug for SFTP, see Bug 518409.

There isn't probably any bug for SMB yet, so use this for it. It seems that the following patch has been merged recently:
https://lists.samba.org/archive/samba-technical/2015-April/106734.html

So the remote copy operation is supported by libsmbclient, but it seems it is not thread-safe, which is a problem...
Comment 3 Ondrej Holy 2016-09-15 10:34:56 UTC
Created attachment 335616 [details] [review]
smb: Add initial remote copy support

Copying is slow currently, because read and write fallback is used for it. Implement native copy support with usage of the recently added support in libsmbclient in order to speed up copying.
Comment 4 Ondrej Holy 2016-09-15 10:35:52 UTC
Created attachment 335617 [details] [review]
smb: Run remote copy in another thread

Copying blocks main thread, so the backend is unresponsive during the copy operation. Let's move the copy operation on another thread.
Comment 5 Ondrej Holy 2016-09-15 10:36:46 UTC
Created attachment 335618 [details] [review]
smb: Add separate context for remote copying

Let's create a separate context for the copy operation, because libsmbclient is not thread-safe.
Comment 6 Ondrej Holy 2016-09-15 14:05:05 UTC
Created attachment 335643 [details] [review]
smb: Add initial remote copy support

Server-side copy support has been added in libsmbclient quite recently:
https://lists.samba.org/archive/samba-technical/2015-April/106734.html

Copying is slow currently, because read and write fallback is used
for it. Implement native copy support with usage of the recently added
support in libsmbclient in order to speed up copying.
Comment 7 Ondrej Holy 2016-09-15 14:08:07 UTC
Created attachment 335644 [details] [review]
smb: Run remote copy in another thread

Copying blocks main thread, so the backend is unresponsive during
the copy operation. Let's move the copy operation on another thread.
Comment 8 Ondrej Holy 2016-09-15 14:08:13 UTC
Created attachment 335645 [details] [review]
smb: Add separate context for remote copying

Let's create a separate context for the copy operation, because
libsmbclient is not thread-safe:
https://lists.samba.org/archive/samba-technical/2015-April/106935.html
Comment 9 Ondrej Holy 2016-09-15 14:08:18 UTC
Created attachment 335646 [details] [review]
smb: Handle cancellation of the copy operation properly

Return "Operation was cancelled" instead of "Invalid argument", which
is returned currently.
Comment 11 Ondrej Holy 2017-01-18 12:38:28 UTC
Created attachment 343714 [details] [review]
smb: Add separate context for blocking operations

A separate context is needed for blocking operations (i.e. copy, push,
pull), because the operations block main thread and libsmbclient is not
fully thread-safe, see:
https://lists.samba.org/archive/samba-technical/2015-April/106935.html
Comment 12 Ondrej Holy 2017-01-18 12:38:55 UTC
Created attachment 343715 [details] [review]
smb: Add initial remote copy support

Server-side copy support has been added in libsmbclient quite recently:
https://lists.samba.org/archive/samba-technical/2015-April/106734.html

Remote copying is slow currently, because read and write fallback is used
for it. Implement native copy support with usage of the recently added
support in libsmbclient in order to speed up remote copying.

Unfortunatelly, you have to add the following in your smb.conf, otherwise
it will be slow as before:
[global]
client max protocol = SMB3
client min protocol = SMB3
Comment 13 Ondrej Holy 2017-01-18 12:42:34 UTC
I've revamped the patches a bit, but I've realized unfortunately that libsmbclient segfaults also with separate contexts (as was mentioned by Ross on the mailing lists) :-(
Comment 14 Ondrej Holy 2017-01-18 12:47:57 UTC
Created attachment 343718 [details]
backtrace

gvfs-copy smb://192.168.127.1/oholy/Downloads/Fedora-Workstation-Live-i386-24-1.2.iso smb://192.168.127.1/oholy/Downloads/smazme.iso &
gvfs-ls smb://192.168.127.1/oholy
The following is printed from libsmbclient: Freed frame ../source3/libsmb/clireadwrite.c:1052, expected ../source3/libsmb/clirap.c:865.
gvfs-ls smb://192.168.127.1/oholy
The following is printed from libsmbclient: ../source3/libsmb/clirap.c:809: Type mismatch: name[NULL] expected[struct cli_qpathinfo2_state]
And the backend aborts...
Comment 15 Ondrej Holy 2017-01-19 12:06:29 UTC
See:
https://bugzilla.samba.org/show_bug.cgi?id=11413
Comment 16 GNOME Infrastructure Team 2018-09-21 18:01:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/286.