On Sun, 29 Jul 2012 22:43:28 +0900 Carsten Haitzler (The Rasterman) <ras...@rasterman.com> wrote:
> On Sun, 29 Jul 2012 14:25:38 +0100 Michael Blumenkrantz > <michael.blumenkra...@gmail.com> said: > > > On Sun, 29 Jul 2012 06:21:10 -0700 > > "Enlightenment SVN" <no-re...@enlightenment.org> wrote: > > > > > Log: > > > and... first monitor mtab not fstab for MOUNT changes/ mtab is > > > "current mounted status" . fstab is "stuff i WANT to mount". > > > > > > secondly.. if mtab is a symlink.. pretend we arent monitoring. this > > > then kicks in the poll checker after mount cmd is done. > > > > > > > > > > > > Author: raster > > > Date: 2012-07-29 06:21:09 -0700 (Sun, 29 Jul 2012) > > > New Revision: 74545 > > > Trac: http://trac.enlightenment.org/e/changeset/74545 > > > > > > Modified: > > > trunk/eeze/src/lib/eeze_disk.c > > > trunk/eeze/src/lib/eeze_disk_libmount_new.c > > > trunk/eeze/src/lib/eeze_disk_mount.c > > > trunk/eeze/src/lib/eeze_disk_private.h > > > > > > Modified: trunk/eeze/src/lib/eeze_disk.c > > > =================================================================== > > > --- trunk/eeze/src/lib/eeze_disk.c 2012-07-29 11:10:45 UTC (rev > > > 74544) +++ trunk/eeze/src/lib/eeze_disk.c 2012-07-29 13:21:09 UTC > > > (rev 74545) @@ -283,6 +283,11 @@ > > > if (disk->mounter) ecore_exe_kill(disk->mounter); > > > _eeze_disks = eina_list_remove(_eeze_disks, disk); > > > eeze_events = eina_list_remove(eeze_events, disk); > > > + if (disk->mount_fail_delay) > > > + { > > > + ecore_timer_del(disk->mount_fail_delay); > > > + disk->mount_fail_delay = NULL; > > > + } > > > free(disk); > > > } > > > > > > > > > Modified: trunk/eeze/src/lib/eeze_disk_libmount_new.c > > > =================================================================== > > > --- trunk/eeze/src/lib/eeze_disk_libmount_new.c 2012-07-29 11:10:45 > > > UTC (rev 74544) +++ trunk/eeze/src/lib/eeze_disk_libmount_new.c > > > 2012-07-29 13:21:09 UTC (rev 74545) @@ -408,6 +408,7 @@ > > > eeze_mount_tabs_watch(void) > > > { > > > libmnt_table *bak; > > > + char *lnk; > > > > > > if (_watching) > > > return EINA_TRUE; > > > @@ -417,7 +418,7 @@ > > > > > > mnt_free_table(_eeze_mount_mtab); > > > _eeze_mount_mtab = bak; > > > - bak = _eeze_mount_tab_parse("/etc/fstab"); > > > + bak = _eeze_mount_tab_parse("/etc/mtab"); > > > EINA_SAFETY_ON_NULL_GOTO(bak, error); > > > > > > mnt_free_table(_eeze_mount_fstab); > > > @@ -433,8 +434,10 @@ > > > if (!_mountinfo) goto error; > > > _mountinfo_fdh = ecore_main_fd_handler_add(fileno(_mountinfo), > > > ECORE_FD_ERROR, _eeze_mount_fdh, NULL, NULL, NULL); if (!_mountinfo_fdh) > > > goto error; > > > - _fstab_mon = ecore_file_monitor_add("/etc/fstab", > > > _eeze_mount_tab_watcher, NULL); > > > - _watching = EINA_TRUE; > > > + _fstab_mon = ecore_file_monitor_add("/etc/mtab", > > > _eeze_mount_tab_watcher, NULL); > > > + lnk = ecore_file_readlink("/etc/mtab"); > > > + if (lnk) free(lnk); > > > + else _watching = EINA_TRUE; > > > > > > return EINA_TRUE; > > > > > > > > > Modified: trunk/eeze/src/lib/eeze_disk_mount.c > > > =================================================================== > > > --- trunk/eeze/src/lib/eeze_disk_mount.c 2012-07-29 11:10:45 UTC > > > (rev 74544) +++ trunk/eeze/src/lib/eeze_disk_mount.c 2012-07-29 > > > 13:21:09 UTC (rev 74545) @@ -55,6 +55,38 @@ > > > } > > > > > > static Eina_Bool > > > +_eeze_disk_mount_fail_delay_check(void *data) > > > +{ > > > + Eeze_Disk *disk = data; > > > + > > > + disk->fail_pol_check++; > > > + if (eeze_disk_mounted_get(disk)) > > > + { > > > + Eeze_Event_Disk_Mount *e; > > > + > > > + disk->mounted = EINA_TRUE; > > > + e = malloc(sizeof(Eeze_Event_Disk_Mount)); > > > + if (e) > > > + { > > > + e->disk = disk; > > > + ecore_event_add(EEZE_EVENT_DISK_MOUNT, e, NULL, NULL); > > > + } > > > + return EINA_FALSE; > > > + } > > > + if (disk->fail_pol_check > 30) > > > + { > > > + if (disk->mount_fail_delay) > > > + { > > > + ecore_timer_del(disk->mount_fail_delay); > > > + disk->mount_fail_delay = NULL; > > > + } > > > + _eeze_disk_mount_error_handler(disk, "mount failure"); > > > + return EINA_FALSE; > > > + } > > > + return EINA_TRUE; > > > +} > > > + > > > +static Eina_Bool > > > _eeze_disk_mount_result_handler(void *data __UNUSED__, int type > > > __UNUSED__, Ecore_Exe_Event_Del *ev) { > > > Eeze_Disk *disk; > > > @@ -79,11 +111,25 @@ > > > disk->mounter = NULL; > > > if (!ev->exit_code) > > > { > > > - disk->mounted = EINA_TRUE; > > > - e = malloc(sizeof(Eeze_Event_Disk_Mount)); > > > - EINA_SAFETY_ON_NULL_RETURN_VAL(e, ECORE_CALLBACK_RENEW); > > > - e->disk = disk; > > > - ecore_event_add(EEZE_EVENT_DISK_MOUNT, e, NULL, NULL); > > > + if (!eeze_disk_mounted_get(disk)) > > > + { > > > + /* libmount seems to have a nasty race condition... or > > > + * mount .. or something... the mount exe returns > > > + * BUT its not mounted yet! so poll for a bit.. and see > > > */ > > > + if (!disk->mount_fail_delay) > > > + disk->mount_fail_delay = > > > + ecore_timer_add(0.1, > > > _eeze_disk_mount_fail_delay_check, > > > + disk); > > > + disk->fail_pol_check = 0; > > > + } > > > + else > > > + { > > > + disk->mounted = EINA_TRUE; > > > + e = malloc(sizeof(Eeze_Event_Disk_Mount)); > > > + EINA_SAFETY_ON_NULL_RETURN_VAL(e, > > > ECORE_CALLBACK_RENEW); > > > + e->disk = disk; > > > + ecore_event_add(EEZE_EVENT_DISK_MOUNT, e, NULL, NULL); > > > + } > > > } > > > else if (ev->exit_code & 2) > > > _eeze_disk_mount_error_handler(disk, "system error (out of > > > memory, cannot fork, no more loop devices)"); @@ -417,6 +463,11 @@ > > > disk->mount_status = EEZE_DISK_NULL; > > > ecore_exe_kill(disk->mounter); > > > disk->mounter = NULL; > > > + if (disk->mount_fail_delay) > > > + { > > > + ecore_timer_del(disk->mount_fail_delay); > > > + disk->mount_fail_delay = NULL; > > > + } > > > } > > > > > > EAPI const char * > > > > > > Modified: trunk/eeze/src/lib/eeze_disk_private.h > > > =================================================================== > > > --- trunk/eeze/src/lib/eeze_disk_private.h 2012-07-29 11:10:45 UTC > > > (rev 74544) +++ trunk/eeze/src/lib/eeze_disk_private.h 2012-07-29 > > > 13:21:09 UTC (rev 74545) @@ -51,6 +51,8 @@ > > > Eina_Bool unmount_cmd_changed : 1; > > > Eina_Bool mounted : 1; > > > Ecore_Exe *mounter; > > > + Ecore_Timer *mount_fail_delay; > > > + int fail_pol_check; > > > > > > const char *syspath; > > > const char *devpath; > > > > > > > parts of this commit are definitely wrong. you changed the fstab watcher, > > which IS intentionally watching fstab (hence the name), to parse the mtab, > > which I also intentionally never wanted to read since it isn't reliable. > > the code refuses to poll (read /proc/self/mounts) if it is WATCHING fstab. > fstab is NEVER modified on a volume mount or unmount - so this logic is > entirely broken already. /etc/mtab is what is modified (traditionally) and > thus *IT* should be watched. as such if its a symlink (to /proc/...) then > this wont work, thus ignore the watcher if it is a symlink. look at the > mounted get eeze_disk_libmount_mounted_get() - which calls > eeze_mount_mtab_scan() which REFUSES to re-read /proc/... if its watching... > this means eeze runs the mount binary, mounts something, then if it tries to > check if its mounted (as efm elsewhere does) it fails every single tome to > detect its mounted as there is a race condition, so i put in the timer to > poll and work around the race to only emit a mount event *IF* eeze agrees the > volume is mounted (as eeze emits a successful mount event then the query says > it is not mounted). i've spent a large chunk of today hunting this down so > finally removable media works at all for me. without this it is broken 100% > of them time. unless i go back to hal, which at least worked. :) > I'll review this further tomorrow, but it's still wrong. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel