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 688471 - "Umount busy device"-DIalog (Samba Share) blocks Gnome-Shell
"Umount busy device"-DIalog (Samba Share) blocks Gnome-Shell
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: general
1.14.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks: 710986
 
 
Reported: 2012-11-16 15:19 UTC by Merlin
Modified: 2014-12-03 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
return G_IO_ERROR_CANCELLED when user cancelled it (4.58 KB, patch)
2014-02-27 17:57 UTC, Ondrej Holy
none Details | Review
return G_IO_ERROR_FAILED_HANDLED when user cancelled it (7.49 KB, patch)
2014-06-30 15:04 UTC, Ondrej Holy
none Details | Review
return G_IO_ERROR_FAILED_HANDLED when user cancelled it (4.77 KB, patch)
2014-06-30 15:09 UTC, Ondrej Holy
reviewed Details | Review
return G_IO_ERROR_FAILED_HANDLED when user cancelled it (1.62 KB, patch)
2014-09-04 15:13 UTC, Ondrej Holy
reviewed Details | Review
set callback to avoid endless loop during unmount (1.35 KB, patch)
2014-09-15 15:52 UTC, Ondrej Holy
needs-work Details | Review
daemon: Set callback to avoid endless loop during unmount (3.46 KB, patch)
2014-09-28 20:58 UTC, Ross Lagerwall
committed Details | Review
gvfsjobunmount: don't unmount if dialog was cancelled (4.81 KB, patch)
2014-11-12 14:28 UTC, Ondrej Holy
committed Details | Review

Description Merlin 2012-11-16 15:19:06 UTC
When I hit the "unmount" button in Nautilus to unmount a busy samba share, a dialog opens that tells me the device is busy. I can choose between "cancel" and "unmount anyway". Neither of these buttons takes effect. No matter which button I press, the window just pops up again. Because it's one of those horrible gnome-shell "alway on top"-popups, it's necessary to kill nautilus via console.

Steps to reproduce:

1. Mount a Samba share with nautilus and gvfs-smb ( smb://192... )
2. Make the share be busy (in my case: stream a movie with vlc, skip to the end → vlc is busy, network is busy)
3. Try to unmount the samba share.

→ popup opens, cannot be closed ordinary.

nautilus: 3.6.3-1
gnome-shell: 3.6.2-1
gvfs-smb: 1.14.2-1
Comment 1 Cosimo Cecchi 2012-11-19 16:37:09 UTC
-> gvfs

Possibly a gvfs bug, Nautilus doesn't do anything special here.
Comment 2 joachim 2013-03-22 20:24:43 UTC
If it helps, I can confirm this bug on openSUSE 12.3 with Gnome 3.6.
Only a kill via console or a restart of the X-server can get rid of this popup.
Comment 3 Richard Körber 2013-03-26 09:08:50 UTC
I can confirm it with Fedora 18, Gnome 3.6 and all updates installed. Neither "cancel" nor "unmount anyway" will do anything, the dialog just reappears and blocks the entire desktop. The only way to escape is to Ctrl-Alt-F2 and kill the gnome session.

Could someone please have a look into this bug? It's pretty annoying having to kill the entire session (and lose all unsaved work) because of this bug.
Comment 4 joachim 2013-03-26 20:57:46 UTC
As a workaround you can simply mount smb/cifs shares via commandline. This has the positive side-effect of being way quicker compared to gvfs.
Comment 5 Ondrej Holy 2014-02-27 17:57:12 UTC
Created attachment 270501 [details] [review]
return G_IO_ERROR_CANCELLED when user cancelled it

This patch solve only a part of the problem. If the backend is busy, the dialog is shown. User can choose between "Force unmount" and "Cancel". If the dialog is cancelled, it is shown again after 2 seconds (if the backend is still busy). The dialog is really annoying, because it is system modal. There is no way to stop showing it, when we can't force unmount the backend. The error G_IO_ERROR_CANCELLED should be returned instead.

However it doesn't solve the problem, that it is impossible to force unmount the backend.
Comment 6 Ondrej Holy 2014-05-29 15:52:40 UTC
Maybe it will be better to return G_IO_ERROR_FAILED_HANDLED...
Comment 7 Ondrej Holy 2014-06-30 15:04:17 UTC
Created attachment 279608 [details] [review]
return G_IO_ERROR_FAILED_HANDLED when user cancelled it
Comment 8 Ondrej Holy 2014-06-30 15:09:56 UTC
Created attachment 279610 [details] [review]
return G_IO_ERROR_FAILED_HANDLED when user cancelled it

reupload, wrong patch attached firstly
Comment 9 Ross Lagerwall 2014-07-05 07:21:09 UTC
Review of attachment 279610 [details] [review]:

There seem to be rather a lot of changes here. Could this not be done with *only* the addition of the following in unmount_cb?
  if (!should_unmount)
  {
    g_vfs_job_failed_literal (G_VFS_JOB (op_job),
                              G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED,
                              "GMountOperation aborted");
    return;
  }

Before this patch, both "force unmount" and "cancel" segfaulted the smb backend for me. With this patch, only "force unmount" segfaults the backend, so it is some improvement at least. We really need to make unmounting, force unmounting, etc more robust :-)

::: daemon/gvfsjobunmount.c
@@ +196,3 @@
+                              G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED,
+                              "GMountOperation aborted (user should never see this "
+                              "error since it is G_IO_ERROR_FAILED_HANDLED)");

I'd prefer a comment like this to be a comment in the code rather than compiled in to the executable, even if the user should never see it.

@@ -258,3 @@
     }
 
-  if (job_finish_immediately_if_possible (op_job))

With the removal of this, if a backend does not implement try_unmount or unmount, it is not possible to unmount it.
Comment 10 Ondrej Holy 2014-09-04 15:12:26 UTC
(In reply to comment #9)
> Review of attachment 279610 [details] [review]:
> 
> There seem to be rather a lot of changes here. Could this not be done with
> *only* the addition of the following in unmount_cb?
>   if (!should_unmount)
>   {
>     g_vfs_job_failed_literal (G_VFS_JOB (op_job),
>                               G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED,
>                               "GMountOperation aborted");
>     return;
>   }

Right, it would be better. I wanted to remove job_finish_immediately_if_possible firstly, because we don't have backends without unmount (do we?)...
Comment 11 Ondrej Holy 2014-09-04 15:13:29 UTC
Created attachment 285394 [details] [review]
return G_IO_ERROR_FAILED_HANDLED when user cancelled it

So there is updated patch :-)
Comment 12 Ondrej Holy 2014-09-15 15:52:07 UTC
Created attachment 286215 [details] [review]
set callback to avoid endless loop during unmount

There is another problem when unmounting. It is not possible to response to unmount dialog after 2 sec timeout, because callback isn't set properly. The dialog is reopen every 2 sec until deamon is killed. It can be fixed by setting the callback on every timeout. However not sure this is right solution, couldn't this cause memory leaks?
Comment 13 Ondrej Holy 2014-09-15 16:58:12 UTC
Review of attachment 285394 [details] [review]:

This patch will be useless if patch 286219 from Bug 710986 is accepted.
Comment 14 Ondrej Holy 2014-09-15 17:16:20 UTC
(In reply to comment #12)
> Created an attachment (id=286215) [details] [review]
> set callback to avoid endless loop during unmount
> 
> There is another problem when unmounting. It is not possible to response to
> unmount dialog after 2 sec timeout, because callback isn't set properly. The
> dialog is reopen every 2 sec until deamon is killed. It can be fixed by setting
> the callback on every timeout. However not sure this is right solution,
> couldn't this cause memory leaks?

This should to fix also this downstream issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1139042
Comment 15 Ondrej Holy 2014-09-22 11:24:11 UTC
(In reply to comment #12)
> Created an attachment (id=286215) [details] [review]
> set callback to avoid endless loop during unmount
> 
> There is another problem when unmounting. It is not possible to response to
> unmount dialog after 2 sec timeout, because callback isn't set properly. The
> dialog is reopen every 2 sec until deamon is killed. It can be fixed by setting
> the callback on every timeout. However not sure this is right solution,
> couldn't this cause memory leaks?

From https://developer.gnome.org/gio/stable/GMountOperation.html#GMountOperation-show-processes :
Note that this signal may be emitted several times to update the list of blocking processes as processes close files. The application should only respond with g_mount_operation_reply() to the latest signal (setting “choice” to the choice the user made).

So the callback should be set properly for the latest signal...
Comment 16 Ross Lagerwall 2014-09-25 22:23:20 UTC
Review of attachment 286215 [details] [review]:

While the original code doesn't seem to work at all, unfortunately I found that this sometimes causes on_show_processes_reply to be called twice causing the backend to segv. I need a little more time to investigate it fully...
Comment 17 Ross Lagerwall 2014-09-25 22:24:47 UTC
(In reply to comment #16)
> Review of attachment 286215 [details] [review]:
> 
> While the original code doesn't seem to work at all, unfortunately I found that
> this sometimes causes on_show_processes_reply to be called twice causing the
> backend to segv. I need a little more time to investigate it fully...

Just to clarify, it seems to get called twice after only responding once from the client app.
Comment 18 Ondrej Holy 2014-09-26 08:41:25 UTC
Thanks, that you look on it. I will make also more testing, but I don't see such behavioral before...
Comment 19 Ross Lagerwall 2014-09-28 20:58:06 UTC
Created attachment 287311 [details] [review]
daemon: Set callback to avoid endless loop during unmount

It is not possible to respond to unmount dialog after 2 sec timeout,
because the callback isn't set properly. The dialog reopens every 2
seconds until the daemon is killed.

Because a dbus method is called every 2 seconds, we may get multiple
replies (e.g. one normal reply and several error replies due to a closed
connection).  Handle this by ignoring all but the first reply.

Based on a patch by Ondrej Holy.
Comment 20 Ross Lagerwall 2014-09-28 21:02:14 UTC
(In reply to comment #18)
> Thanks, that you look on it. I will make also more testing, but I don't see
> such behavioral before...

My test app was completing the unmount and then immediately exiting. This closed the dbus connection so all the outstanding replies would complete (probably with an error) and complete_unmount_with_op would get more than once, causing a segfault.  The attached patch (based on yours) fixes the problem.
Comment 21 Ondrej Holy 2014-09-29 12:48:06 UTC
Review of attachment 287311 [details] [review]:

Good point, thanks!
Comment 22 Ross Lagerwall 2014-10-17 19:25:16 UTC
Pushed to master as ea347458a314ef1d99ed845b514f33b8af374ad7. Thanks for the review!
Comment 23 Ondrej Holy 2014-11-10 13:14:32 UTC
We should to backport this patch at least for gnome-3-14...
Comment 24 Ondrej Holy 2014-11-11 15:20:25 UTC
But it should be backported together with attachment 286802 [details] [review] to make sense, but not sure, whether we can do that since it is slightly changing behavioral of unmount operation...
Comment 25 Ondrej Holy 2014-11-12 14:28:25 UTC
Created attachment 290521 [details] [review]
gvfsjobunmount: don't unmount if dialog was cancelled

There is modified version of attachment 286802 [details] [review] targeted for stable releases. It changes only the case, when user cancelled the dialog. Other cases are untouched to be sure there won't be problems with changing api...

Could you please recheck it when it is targeted for stable releases (gnome-3-14 at least)?
Comment 26 Ross Lagerwall 2014-12-02 22:38:36 UTC
Review of attachment 290521 [details] [review]:

Looks good to me!
Comment 27 Ross Lagerwall 2014-12-02 22:40:13 UTC
Yes, getting attachment 290521 [details] [review] and attachment 287311 [details] [review] into some stable releases would be pretty good since this bug is really annoying.
Comment 28 Ondrej Holy 2014-12-03 08:56:00 UTC
Comment on attachment 290521 [details] [review]
gvfsjobunmount: don't unmount if dialog was cancelled

Thanks for review!

Both patches are committed into gnome-3-14 as:
commit 4cff08d1d9c458eb3ee46a4c4326626fffcaa7a8
commit 634b12a093779aac626757ab41d91ef07d7ce251
Comment 29 Ondrej Holy 2014-12-03 09:20:33 UTC
I pushed the patches also into gnome-3-12 finally as:
commit 71f4f71db67633a3984db480c814b7946d1faf7a
commit 6d51022f5af92fcbb05eace1a850f0ef72294cc8

and gnome-3-10 as:
commit 6344510ccebfbc73dd9ecf9106aa8234959156c7
commit a7d4b2e86c303642720138a9df188df35fb8d63f