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 625552 - wrong behaviour of GVolume GVolumeMonitor related functions with mount --bind
wrong behaviour of GVolume GVolumeMonitor related functions with mount --bind
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-07-29 07:57 UTC by Sebastian
Modified: 2013-01-24 09:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gvfs-mount -li (1.88 KB, text/plain)
2010-08-21 20:11 UTC, Sebastian
  Details
libatasmart4 version (23 bytes, text/plain)
2010-08-21 20:12 UTC, Sebastian
  Details
gvfs_version (21 bytes, text/plain)
2010-08-21 20:12 UTC, Sebastian
  Details
udev_version (7 bytes, text/plain)
2010-08-21 20:12 UTC, Sebastian
  Details
fstab (1.22 KB, text/plain)
2010-08-21 20:13 UTC, Sebastian
  Details
mountinfo (1.48 KB, text/plain)
2010-08-21 20:13 UTC, Sebastian
  Details
udevadm_info (114.69 KB, text/plain)
2010-08-21 20:14 UTC, Sebastian
  Details
udisks--dump (20.81 KB, text/plain)
2010-08-21 20:14 UTC, Sebastian
  Details
first try, works partially (693 bytes, patch)
2010-12-12 14:38 UTC, Sebastian
none Details | Review
Ignore fstab entries that are bind mounts (1022 bytes, patch)
2013-01-23 11:08 UTC, Alexander Larsson
committed Details | Review

Description Sebastian 2010-07-29 07:57:38 UTC
* g_volume_monitor_get_volumes() returns volumes that are mounted with the 
  --bind option. These volumes are not assigned a drive (probably correct) and
  also not a GMount mount point (this is probably incorrect).

* Checking whether these drives can be mounted with:
  g_volume_can_mount() returns TRUE (even if the bind mounted volume is already mounted). Im not sure if this is correct since the documentation says nothing about the return value for devices that are already mounted, might be correct.
* g_volume_get_mount() returns NULL (this is probably incorrect)
* g_volume_get_drive() returns NULL
* Checking for the UUID of the volume gives: NULL

trying to mount the device gives an error such as (taken from nautilus):
-------------------DIALOG----------------------------------
Unable to mount DATA

mount: according to mtab, /media/DATA is already mounted on /home/username/DATA
mount failed
------------------DIALOG END-------------------------------

The described behaviour produces bug: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/452049 in nautilus

I have already gone through the nautilus source and believe that it is not a nautilus bug, but results from a bug in glib, which is that mount points mounted with --bind do not get a mount point assigned in glib.

FYI: the interesting code points in nautilus are:
libnautilus-private/nautilus-file-operations.c
:2372 (call to g_volume_mount())
:2303 (mount callback invokes error message)
src/nautilus-places-sidebar.c:458 (else block, mount --bind points are added)
Comment 1 David Zeuthen (not reading bugmail) 2010-08-17 16:06:28 UTC
Please provide the information requested here: http://www.freedesktop.org/wiki/Software/udisks
Comment 2 Sebastian 2010-08-21 20:11:46 UTC
Created attachment 168470 [details]
gvfs-mount -li
Comment 3 Sebastian 2010-08-21 20:12:06 UTC
Created attachment 168471 [details]
libatasmart4 version
Comment 4 Sebastian 2010-08-21 20:12:23 UTC
Created attachment 168472 [details]
gvfs_version
Comment 5 Sebastian 2010-08-21 20:12:56 UTC
Created attachment 168473 [details]
udev_version
Comment 6 Sebastian 2010-08-21 20:13:16 UTC
Created attachment 168474 [details]
fstab
Comment 7 Sebastian 2010-08-21 20:13:31 UTC
Created attachment 168475 [details]
mountinfo
Comment 8 Sebastian 2010-08-21 20:14:07 UTC
Created attachment 168476 [details]
udevadm_info
Comment 9 Sebastian 2010-08-21 20:14:27 UTC
Created attachment 168477 [details]
udisks--dump
Comment 10 Sebastian 2010-08-21 20:18:18 UTC
Sorry for the delay, i was rather busy in the last days, here are the files requested. Let me know if I can do anything more to help fixing this bug soon and thank you for taking the time to look into it.
Comment 11 Yuriy Tertichnyy 2010-12-01 21:35:43 UTC
Confirm. g_volume_get_mount() always returns NULL for my when g_volume_mount_finish return TRUE and device mounted successfully.
Comment 12 Yuriy Tertichnyy 2010-12-01 21:46:02 UTC
uname -rsvpi
Linux 2.6.32.24-1-i686-s32 #1 SMP Sat Nov 6 23:01:27 MSK 2010 Celeron(R)
Dual-Core CPU       T3100  @ 1.90GHz GenuineIntel

udevadm --version
163

glib-2.26.0

cat /etc/fstab 
#/dev/ram        /               ext2    defaults   1   1
/dev/sda5        /               reiserfs defaults 1 1
/swapfile swap swap defaults 0 0
#/dev/sda4        /mnt            reiserfs defaults 1 1
/dev/sda4        /mnt            reiser4 defaults 1 1
#/dev/shm  tmpfs defaults 0 0
none             /dev/shm        tmpfs  
defaults,size=1024M,noexec,nodev,nosuid        0       0
usbfs            /proc/bus/usb   usbfs   defaults       0 0
/dev/uba1       /media/uba1     ext2    defaults,noauto,user    0       0
/dev/sdb1       /media/sdb1     reiserfs    defaults,noauto,user    0       0
#/dev/uba1       /media/uba1     auto    defaults,noauto,user    0       0
#/dev/uba1       /media/usb     vfat    noauto,owner    0       0
Comment 13 Sebastian 2010-12-05 10:36:39 UTC
I believe the necessary checks need to be added in the file glib/gio/gunixvolume.c In g_unix_volume_can_mount(), as this function always returns TRUE at the moment. 
Another possible option would be to add a check in gunixmounts.c at _g_get_unix_mounts() or _g_get_unix_mount_points() line 840, where the is_user_mountable variable is set.

I will keep looking. 
Cheers Sebastian
Comment 14 Sebastian 2010-12-05 11:03:25 UTC
Maybe we could also pass the current mount options to guess_system_internal() and then check for the bind option. Afterall a bind mounted mount can be considered an internal mount.
Comment 15 Sebastian 2010-12-05 11:22:27 UTC
Requesting to mark this as confirmed. See yours comment.
Comment 16 Matthias Clasen 2010-12-09 00:25:34 UTC
Not a gnome3 blocker, I think.
Comment 17 Sebastian 2010-12-12 12:09:20 UTC
Not a gnome blocker but never the less confirmed. I also think that it would probably be easy to fix for someone more familiar with glib and gio.

In Debian this is considered as important:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=601784
Comment 18 Sebastian 2010-12-12 14:38:31 UTC
Created attachment 176287 [details] [review]
first try, works partially

After starting nautilus i get a couple off errors and the mounting process does not work correctly any more, but the bind mounted mount does not appear any more.

Initializing nautilus-gdu extension

(nautilus:10952): GConf-CRITICAL **: gconf_value_free: assertion `value != NULL' failed

(nautilus:10952): GConf-CRITICAL **: gconf_value_free: assertion `value != NULL' failed

(nautilus:10952): GdkPixbuf-CRITICAL **: gdk_pixbuf_format_get_name: assertion `format != NULL' failed
Comment 19 Sebastian 2011-10-14 11:20:40 UTC
I was just wondering if there has been any progress made on this bug.
Comment 20 Alexander Larsson 2013-01-23 10:56:25 UTC
I don't think we should even show volumes for these, since we (try to) ignore bind mounts as mounts. So, rather than the patch in comment #18 it should do something like

 if (hasmntopt (mntent, "bind"))
   continue;

Can you try that?
Comment 21 Alexander Larsson 2013-01-23 11:08:21 UTC
Created attachment 234176 [details] [review]
Ignore fstab entries that are bind mounts

We don't show the bind mounts anyway, so it only leads to
problems when we show the fstab entries, like being unable
to mount them.
Comment 22 Alexander Larsson 2013-01-23 11:08:50 UTC
Like that, does that help?
Comment 23 Sebastian 2013-01-23 14:37:17 UTC
Review of attachment 234176 [details] [review]:

I can confirm that this fixes the bug. I tested it under Ubuntu 12.10 by compiling it into the prefix /opt/gnome/test/ and then running

    LD_LIBRARY_PATH=/opt/gnome/test/lib /usr/lib/gvfs/gvfs-udisks2-volume-monitor

I left the program running, then I needed to kill any running nautilus window and run the normal nautilus without the LD_LIRBARY_PATH env variable. The result is that the bind mount is no longer shown. I also did not experience any negative side effects. So this can be commited now.
Comment 24 Sebastian 2013-01-23 14:38:12 UTC
P.S Thank you very much Alexander, this bug has been annoying me for a long time. I'm glad you could fix it.
Comment 25 David Zeuthen (not reading bugmail) 2013-01-23 14:42:23 UTC
(In reply to comment #21)
> Created an attachment (id=234176) [details] [review]
> Ignore fstab entries that are bind mounts
> 
> We don't show the bind mounts anyway, so it only leads to
> problems when we show the fstab entries, like being unable
> to mount them.

FWIW, seems like a reasonable thing to me.
Comment 26 Alexander Larsson 2013-01-24 09:07:44 UTC
Attachment 234176 [details] pushed as b0d5ce1 - Ignore fstab entries that are bind mounts