[Bug 558926] Re: Open files on ejected media confuse the system

Phillip Susi psusi at cfl.rr.com
Fri Apr 9 16:20:42 UTC 2010


On 4/9/2010 4:39 AM, Martin Pitt wrote:
> Closing udisks task, since udisks can't do anything about open FDs in
> other processes.

I wouldn't expect it to, but it ( or whichever component nautilus
depends on ) should not get confused and make the drive vanish and
refuse to recognize new media.

> Indeed forced unmounts are done with -l (lazy unmount), there is not
> much else that you can do -- you can't pull away open file descriptors
> from underneath bash and other processes -- what should they do about
> it? You'd need to tell them "please go drop this file or change
> directory, etc", which only the application itself can do. The
> alternative would be to force the application to crash, but in terms of
> not losing data this isn't the best solution either.

Media removal should be using a forced unmount, not a lazy one.  This
should cause the open inodes to be discarded, and the file descriptors
that point to them to be invalidated.  Any further requests using those
file descriptors should fail with -EBADF, which may or may not cause
applications to crash.

Windows actually has a nice trick where it basically does a lazy unmount
when the media is removed and suspends any IO requests to that fs, then
if the original media is put back, the mount point is reattached and the
still open fds continue working.

> However, what does look fishy is that a newly added USB stick wouldn't
> mount and work normally -- if there's a stale mount on, say, /dev/sdb,
> then the next device should just get /dev/sdc assigned.

No USB is involved; this is just inserting a new media in the cdrom.
You can still manually mount /dev/sr0, but for some reason, nautilus
refuses to even see that there is a drive there with no media in it.
Closing the stale file descriptors after removing the media causes the
drive to show up again in nautilus.

-- 
Open files on ejected media confuse the system
https://bugs.launchpad.net/bugs/558926
You received this bug notification because you are a member of Kernel
Bugs, which is subscribed to linux in ubuntu.




More information about the kernel-bugs mailing list