Re: cannot delete directory - why?

Brian May (bam@snoopy.apana.org.au)
Mon, 4 Oct 1999 09:03:18 +1000


On Sun, Oct 03, 1999 at 03:39:44PM +0200, Guest section DW wrote:
> From bam@snoopy.apana.org.au Sun Oct 3 01:07:22 1999
>
> I exited the chroot environment and tried to remove the pts directory.
> This pts filesystem returned the error "file not found" - is this to
> be expected? This file not found error confused rm, which entered an
> infinite loop (perhaps I should file a bug report against rm?)
>
> The first is a kernel bug, the second an rm bug.
> Clearly, you already submitted a kernel bug report. I submitted a patch.
> It is a good idea also to submit an rm bug report.

I am now wondering if it *is* a bug in rm?

I think the behaviour of rm could be explained as follows (not that
I have seen the source code). rm gets a listing of the drectory. It
then tries to delete all the files within that directory. When it sees
the error "file not found", it gets confused - how could that file
not exist, when I only just got its entry? So it assumes that a race
condition exists, where another process may have deleted it, and
re-reads the directory, hence seeing the same file again.

Perhaps it should really have a limit of how many times it will rescan
the same directory?

-- 
Brian May <bam@snoopy.apana.org.au>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/