bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash and "hogging" directories


From: Ralph Corderoy
Subject: Re: Bash and "hogging" directories
Date: Sun, 14 Jul 2002 17:12:39 GMT

Hi pesarif,

> On Tue, 2 Jul 2002 22:49, Chet Ramey wrote:
> > > [root@tux /]# umount /usr/share/timidity
> > > umount: /usr/share/timidity: device is busy
> > >
> > > It is busy because bash has somehow "hogged" the directory because
> > > I had cd'ed into it (i.e. cd /usr/share/timidity):
> > >
> > > bash       4746      joe  cwd    DIR        7,1     4096     98853
> > > /usr/share/timidity
> > >
> > > Could you please prevent bash from "hogging" the directory or
> > > marking it as in use/busy?  Is it really neccessary to tell Linux
> > > that the directory is in use when all I have done is cd into it?
> >
> > This is not a bash issue.
>
> I'm curious as to why it happens (please tell me why).  Are there ways
> to prevent this from happening?

Unix, which Linux is based on, will not unmount a filesystem that is in
use.  Every process on the machine has a `current directory', not just
bash processes.  It may also have some files opened.  If any of those
files, or the current directory, is on a filesystem it counts as a use
of that filesystem.

So it's not just bash that is doing this, all processes do.  Try

    sleep 60 &
    /usr/sbin/lsof -p <pid_of_sleep>

and you'll see it has a `cwd' too.

Kernighan and Pike's _The Unix Programming Environment_ is an excellent
book for these kind of issues.

In your case, just `cd' before attempting the unmount.

Cheers,


Ralph.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]