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 708316 - gphoto2: Exit cleanly when device is removed
gphoto2: Exit cleanly when device is removed
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: gphoto backend
unspecified
Other All
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2013-09-18 16:36 UTC by Bastien Nocera
Modified: 2015-03-10 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gphoto2: Exit cleanly when device is removed (1.31 KB, patch)
2013-09-18 16:37 UTC, Bastien Nocera
needs-work Details | Review
gphoto2: Exit cleanly when device is removed (1.31 KB, patch)
2014-06-03 14:39 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2013-09-18 16:36:59 UTC
I didn't test this, but I would expect it to create the same bug
as for the afc backend, which fails to exit when this is called.

https://bugzilla.gnome.org/show_bug.cgi?id=708288
Comment 1 Bastien Nocera 2013-09-18 16:37:01 UTC
Created attachment 255234 [details] [review]
gphoto2: Exit cleanly when device is removed

As the other backends do, and removes 2 FIXMEs.
Comment 2 Ondrej Holy 2013-10-17 14:51:58 UTC
Review of attachment 255234 [details] [review]:

It looks good with small fix.

::: daemon/gvfsbackendgphoto2.c
@@ +828,3 @@
       caches_invalidate_all (gphoto2_backend);
 
+      g_vfs_backend_force_unmount ((GVfsBackend *) gphoto2_backend);

Would be nice to use preferably G_VFS_BACKEND (gphoto2_backend).

@@ +1046,3 @@
       caches_invalidate_all (gphoto2_backend);
 
+      g_vfs_backend_force_unmount ((GVfsBackend *) gphoto2_backend);

Ditto.
Comment 3 Bastien Nocera 2013-11-02 00:07:18 UTC
Except that it's broken anyway, because g_vfs_backend_force_unmount() doesn't work.
Comment 4 Bastien Nocera 2014-06-03 14:39:09 UTC
Created attachment 277804 [details] [review]
gphoto2: Exit cleanly when device is removed

As the other backends do, and removes 2 FIXMEs.
Comment 5 Ross Lagerwall 2014-06-03 16:15:17 UTC
(In reply to comment #3)
> Except that it's broken anyway, because g_vfs_backend_force_unmount() doesn't
> work.

Why doesn't it work?  It works for the sftp backend, in my testing, so I don't see why it wouldn't work for the other backends.
Comment 6 Bastien Nocera 2014-06-03 16:20:31 UTC
(In reply to comment #5)
> (In reply to comment #3)
> > Except that it's broken anyway, because g_vfs_backend_force_unmount() doesn't
> > work.
> 
> Why doesn't it work?  It works for the sftp backend, in my testing, so I don't
> see why it wouldn't work for the other backends.

Shadowed mounts is my guess. Both the gphoto2 and the afc backend suffer from mounts not disappearing, and the main difference with the other backends using force unmount is shadowed mounts.
Comment 7 Ross Lagerwall 2014-06-04 06:25:33 UTC
Review of attachment 277804 [details] [review]:

Looks good.
Comment 8 Bastien Nocera 2014-06-04 10:20:45 UTC
Review of attachment 277804 [details] [review]:

I'm not committing it, it doesn't work.
Comment 9 Ondrej Holy 2014-06-05 16:19:03 UTC
What exactly doesn't work? It seems working for me... 

$ GVFS_DEBUG=1 /opt/gnome/libexec/gvfsd --replace

Connect device:

initing 0x256d070
Added new job source 0x256d070 (GVfsBackendGphoto2)
Queued new job 0x2553ef0 (GVfsJobMount)
try_mount 0x256d070  host=[usb:002,004]
do_mount 0x256d070  host='[usb:002,004]'
decoded host='usb:002,004'
Parsed 'usb:002,004' into device name /dev/bus/usb/002/004
-> sysfs path /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2, subsys usb, name 2-1.2
gphoto2_port='usb:002,004'Using ignore_prefix='/store_00010001/'
can_write = 1
can_delete = 1
send_reply, failed: 0
mounted 0x256d070

Remove device:

on_uevent action remove, device (null)
on_uevent action remove, device /dev/bus/usb/002/004
we have been removed!
caches_invalidate_all()
forced_unregister_mount_callback
finalizing 0x256d070
Comment 10 Christophe Fergeau 2015-03-10 10:31:21 UTC
For the record, g_vfs_backend_force_unmount() does work in the afc backend.
Comment 11 Ondrej Holy 2015-03-10 11:22:26 UTC
Bastien?
Comment 12 Bastien Nocera 2015-03-10 11:35:35 UTC
No idea. Commit it and wait for bugs to roll in?
Comment 13 Ondrej Holy 2015-03-10 11:44:45 UTC
Please push it if you didn't push it before only because it doesn't work for afc and you didn't test it with gphoto2...

It works for me with my mobile phone, backend is terminated correctly.
Comment 14 Bastien Nocera 2015-03-10 13:48:06 UTC
Attachment 277804 [details] pushed as a4f0bf3 - gphoto2: Exit cleanly when device is removed