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 759061 - sftp does not cancel jobs properly
sftp does not cancel jobs properly
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: sftp backend
1.26.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2015-12-05 14:35 UTC by Ross Lagerwall
Modified: 2015-12-15 05:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sftp: Fail cancelled jobs (2.91 KB, patch)
2015-12-05 14:37 UTC, Ross Lagerwall
none Details | Review
sftp: Fail cancelled jobs (2.87 KB, patch)
2015-12-12 08:53 UTC, Ross Lagerwall
committed Details | Review

Description Ross Lagerwall 2015-12-05 14:35:10 UTC
If you copy a large file to/from an sftp mount and then cancel it, the job is not finished and it subsequently blocks unmounting.
Comment 1 Ross Lagerwall 2015-12-05 14:37:48 UTC
Created attachment 316803 [details] [review]
sftp: Fail cancelled jobs

Fail jobs which have been marked as cancelled, otherwise the job remains
and blocks unmounting. This can be reproduced by cancelling while
copying a large file to/from a mount and then trying to unmount it.
Comment 2 Ondrej Holy 2015-12-07 14:00:34 UTC
Review of attachment 316803 [details] [review]:

Thanks for the patch, it fixes the mentioned problem...

::: daemon/gvfsbackendsftp.c
@@ +5479,3 @@
   g_clear_object (&handle->in);
 
+  if (g_vfs_job_is_finished (handle->job) || finish_cancelled_job (handle->job))

I just wonder why g_vfs_job_is_finished() is needed in those checks? If it is really needed, maybe I would move it into finish_cancelled_job() also and rename somehow...
Comment 3 Ross Lagerwall 2015-12-12 08:53:17 UTC
Created attachment 317245 [details] [review]
sftp: Fail cancelled jobs

Fail jobs which have been marked as cancelled, otherwise the job remains
and blocks unmounting. This can be reproduced by cancelling while
copying a large file to/from a mount and then trying to unmount it.
Comment 4 Ross Lagerwall 2015-12-12 08:57:11 UTC
(In reply to Ondrej Holy from comment #2)
> Review of attachment 316803 [details] [review] [review]:
> 
> Thanks for the patch, it fixes the mentioned problem...
> 
> ::: daemon/gvfsbackendsftp.c
> @@ +5479,3 @@
>    g_clear_object (&handle->in);
>  
> +  if (g_vfs_job_is_finished (handle->job) || finish_cancelled_job
> (handle->job))
> 
> I just wonder why g_vfs_job_is_finished() is needed in those checks? If it
> is really needed, maybe I would move it into finish_cancelled_job() also and
> rename somehow...

g_vfs_job_is_finished() is used when there is more than concurrent outstanding action. For example, it might do a read from a local file and a write to the server (of previously read local data). If the write gets an error, it fails the job. When the read completes (push_read_cb) it needs to check whether the job has completed before it can continue.

For this reason, I've updated the patch as you suggested.
Comment 5 Ondrej Holy 2015-12-14 08:18:25 UTC
Review of attachment 317245 [details] [review]:

Looks good, thanks! It would be nice to push it also for stable...
Comment 6 Ondrej Holy 2015-12-14 13:05:07 UTC
Comment on attachment 317245 [details] [review]
sftp: Fail cancelled jobs

I've pushed the patch to master (commit 5e65aa2) and gnome-3-18 (commit 1085c64) myself in order to have it in the upcoming release...
Comment 7 Ross Lagerwall 2015-12-15 05:11:53 UTC
(In reply to Ondrej Holy from comment #6)
> Comment on attachment 317245 [details] [review] [review]
> sftp: Fail cancelled jobs
> 
> I've pushed the patch to master (commit 5e65aa2) and gnome-3-18 (commit
> 1085c64) myself in order to have it in the upcoming release...

Thanks!