Bug 81777 - gnome-sound-recorder monitors read-only mount points, preventing unmounting
Summary: gnome-sound-recorder monitors read-only mount points, preventing unmounting
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gnome-media
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Colin Walters
QA Contact: Jay Turner
Depends On:
Blocks: 79579 CambridgeTarget
TreeView+ depends on / blocked
Reported: 2003-01-13 21:28 UTC by Owen Taylor
Modified: 2015-01-08 00:02 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2004-07-26 17:18:12 UTC

Attachments (Terms of Use)
small bit of sample code (892 bytes, text/plain)
2003-01-31 18:12 UTC, Jonathan Blandford
no flags Details

Description Owen Taylor 2003-01-13 21:28:04 UTC
How to reproduce:

 - Insert a CD, let magicdev mount it (or mount it manually)
 - Open Nautilus on a subdirectory of the CD-ROM. (Not
   sure if the subdirectory is necessary) 
 - Close the window
 - Select eject from the right click menu of the device
   or any other way, and you'll get

    umount: /mnt/cdrom: device is busy

I added code to nautilus at one point so that directories
on read-only mounted volumes didn't get monitored, but
this apparently is no longer working.

Comment 1 Alexander Larsson 2003-01-17 12:36:00 UTC
Strange. This works for me both on phoebe and on 8.0 with gnome 2.2 from cvs.
Can you use lsof to see exactly which file is open on it?

Comment 2 Owen Taylor 2003-01-17 17:38:48 UTC
Turns out that the essential step here is to double click on a HTML
file on the CD and launch mozilla. If you then close everything, you
get into the stuck state.

fam is monitoring the directory in which the file that you launched
was in.

Comment 3 Alexander Larsson 2003-01-21 12:26:45 UTC
I don't understand this at all. I was able to reproduce this once (the first
time), but now it works all the time. (Mine opened in OOo instead of moz though.)

Comment 4 Alexander Larsson 2003-01-31 12:26:19 UTC
Ok, i finally tracked this one down. The problem is not nautilus itself, the
problem is the recent-files code. It (via the panel) opens a monitor on the
files in the recently-opened list.

This totally sucks, because it means any document opened on a removable media
will be unmountable until you've opened some more documents to push the first
document off the list.

I don't really know why its monitorig the file. Not monitoring read-only mounts
helps a bit, but still means floppies and other removable writable media are hosed.

Comment 5 Alexander Larsson 2003-01-31 12:27:05 UTC
To top it all of the recent-files code is in libegg, so it's cut-and-pasted all
over i guess.

Comment 6 James Willcox 2003-01-31 14:49:54 UTC
Yeah, this really sucks.  The recent-files code monitors the files in the list
so if one of them is deleted, it gets removed from the list.  I had a gut
feeling that it was going to cause problems some how...guess I should have
followed it.  Anyway, I'm not really sure what to do here except rip out the
monitoring code.  Suggestions?

Comment 7 Havoc Pennington 2003-01-31 15:43:10 UTC
In the absence of a smarter monitor system (that FAM replacement will have 
"drop all monitors so we can unmount", right?)
turning off monitoring is probably the only quick fix.

Comment 8 Jonathan Blandford 2003-01-31 18:09:49 UTC
A better fix might be to see what mount point you're on and only add the monitor
if it's on a known 'safe' mount point.  I'm attaching some very simple sample
code to check the mount point of a filename.   Regretfully, it uses libgtop, so
you'll prolly have to find Martin and ask him if he minds you extracting the
necessary code and relicensing it.  Not a quick fix, but better than nothing. 
If it's not safe, you can prolly just ping it every 10 seconds or something to
see if it has changed.

Comment 9 Jonathan Blandford 2003-01-31 18:12:31 UTC
Created attachment 89740 [details]
small bit of sample code

Comment 10 Owen Taylor 2003-01-31 20:54:05 UTC
Note that the read-write unmountable media problem occurs with Nautilus
as well... it's only the problem with

If we want to handle read-write unmountable file systems, I think
we should probably go off more accurate stuff than path names. (We
can find out the mount device, file system type, etc.) Nautilus
and gnome-vfs already do various things along these lines.

Of course, losing monitoring for nautilus on various volumes would suck;
for the MRU files stuff it's probably less important.

Comment 11 Alexander Larsson 2003-02-03 16:17:08 UTC
Short term i think we should just disable the monitoring for recent-files
(especially in the panel which runs all the time).

long term the optimal solution would be a kernel API that didn't require you to
keep files open. Barring that I think a fam-replacement could have a "i want to
unmount $path, drop monitors in it" function. heuristics on where to monitor
seem kind of busted.

Comment 12 Alexander Larsson 2003-02-05 14:27:44 UTC
Latest gnome-panel, gedit and file-roller packages all have this patched out
now. These were all instances i could find, so I think this is fixed.

Comment 13 Alexander Larsson 2003-02-05 16:09:35 UTC
There seem to be one in gnome-sound-recorder too

Comment 14 Colin Walters 2004-07-26 17:18:12 UTC
I don't see any recent files code in gnome-sound-recorder anymore, so
it looks like this bug is fixed.

Note You need to log in before you can comment on or make changes to this bug.