File Descriptor release?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

File Descriptor release?

Yoshiki Ohshima
  Hello,

  Lately I'm moving files back and forth between a Windows PC and an
OLPC test board via a USB memory in VFAT.  The OLPC test board runs
official OLPC kernel (build 94) that is a modified Linux.  Here I have
a problem to unmount the file system after Squeak opens something on
the file system.

  A typical workflow is:

  * There are bare minimum stuff running on the board.  On X, xterm
    and twm and that is it.

  * mount a USB memory on the board:

    mount -t vfat /dev/sdb1 /mnt

  * launch Squeak.  The binary of VM and image are on a different
    file system than /dev/sdb1.

  * open a FileList, and navigate to /mnt.

  * close the FileList.  Do 'purge undo records' (just for the heck of
    it) and do fullGC couples of times.

  * go to xterm while Squeak is running and try:

    umount /mnt

    I get "device is busy" error.

  * close Squeak and try unmount again.  I can unmount the file system
    this time.

  The VM is 3.9-8 that I compiled from the repository.  Is this
something to do with the Linux VFAT driver, or a problem with the
Squeak VM?

-- Yoshiki

Reply | Threaded
Open this post in threaded view
|

Re: File Descriptor release?

johnmci
Being a unix system does it have lsof available?

If so that will certainly tell you what file handles are open by the  
squeak vm.


On 13-Oct-06, at 1:02 PM, Yoshiki Ohshima wrote:

>   Hello,
>
>   Lately I'm moving files back and forth between a Windows PC and an
> OLPC test board via a USB memory in VFAT.  The OLPC test board runs
> official OLPC kernel (build 94) that is a modified Linux.  Here I have
> a problem to unmount the file system after Squeak opens something on
> the file system.
>
>   A typical workflow is:
>
>   * There are bare minimum stuff running on the board.  On X, xterm
>     and twm and that is it.
>
>   * mount a USB memory on the board:
>
>     mount -t vfat /dev/sdb1 /mnt
>
>   * launch Squeak.  The binary of VM and image are on a different
>     file system than /dev/sdb1.
>
>   * open a FileList, and navigate to /mnt.
>
>   * close the FileList.  Do 'purge undo records' (just for the heck of
>     it) and do fullGC couples of times.
>
>   * go to xterm while Squeak is running and try:
>
>     umount /mnt
>
>     I get "device is busy" error.
>
>   * close Squeak and try unmount again.  I can unmount the file system
>     this time.
>
>   The VM is 3.9-8 that I compiled from the repository.  Is this
> something to do with the Linux VFAT driver, or a problem with the
> Squeak VM?
>
> -- Yoshiki
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: File Descriptor release?

Ian Piumarta-2
In reply to this post by Yoshiki Ohshima
Hi Yoshiki,

>     umount /mnt
>     I get "device is busy" error.
>
>   * close Squeak and try unmount again.  I can unmount the file system
>     this time.

The unix vm caches the last open directory to speed up directory
searches.  (Because of the way the image searches directories, this
caching results in linear time instead of exponential with the size of
the directory.)  If you change away from /mnt in the file list you
should be able to umount from the terminal.  If not, ignore this
entire message. ;-)

Cheers,
Ian

Reply | Threaded
Open this post in threaded view
|

Re: File Descriptor release?

Yoshiki Ohshima
  Ian,

> The unix vm caches the last open directory to speed up directory
> searches.  (Because of the way the image searches directories, this
> caching results in linear time instead of exponential with the size of
> the directory.)  If you change away from /mnt in the file list you
> should be able to umount from the terminal.  If not, ignore this
> entire message. ;-)

  Ah, now I check maybeOpenDir().

  So, since the speed up is indispensable, probably Squeak-level code
should visit the defaultDirectory. to flush the cache on some
occasions?

-- Yoshiki

Reply | Threaded
Open this post in threaded view
|

Re: File Descriptor release?

David T. Lewis
In reply to this post by johnmci
Assuming that you know the process id of the squeak vm, the currently
open file handles are listed in the /proc/<squeakVmPid>/fd directory.

Aside from figuring out what files are currently open, this is also
useful if you ever have a VM that is locked up on a blocking read
operation. You can just echo some data to /proc/<squeakVmPid>/<someFd>,
and the Squeak image will wake up and come back to life.

Dave

On Fri, Oct 13, 2006 at 01:18:28PM -0700, John M McIntosh wrote:

> Being a unix system does it have lsof available?
>
> If so that will certainly tell you what file handles are open by the  
> squeak vm.
>
>
> On 13-Oct-06, at 1:02 PM, Yoshiki Ohshima wrote:
>
> >  Hello,
> >
> >  Lately I'm moving files back and forth between a Windows PC and an
> >OLPC test board via a USB memory in VFAT.  The OLPC test board runs
> >official OLPC kernel (build 94) that is a modified Linux.  Here I have
> >a problem to unmount the file system after Squeak opens something on
> >the file system.
> >
> >  A typical workflow is:
> >
> >  * There are bare minimum stuff running on the board.  On X, xterm
> >    and twm and that is it.
> >
> >  * mount a USB memory on the board:
> >
> >    mount -t vfat /dev/sdb1 /mnt
> >
> >  * launch Squeak.  The binary of VM and image are on a different
> >    file system than /dev/sdb1.
> >
> >  * open a FileList, and navigate to /mnt.
> >
> >  * close the FileList.  Do 'purge undo records' (just for the heck of
> >    it) and do fullGC couples of times.
> >
> >  * go to xterm while Squeak is running and try:
> >
> >    umount /mnt
> >
> >    I get "device is busy" error.
> >
> >  * close Squeak and try unmount again.  I can unmount the file system
> >    this time.
> >
> >  The VM is 3.9-8 that I compiled from the repository.  Is this
> >something to do with the Linux VFAT driver, or a problem with the
> >Squeak VM?
> >
> >-- Yoshiki
> >
>
> --
> ========================================================================
> ===
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ========================================================================
> ===
>
>