Re: Deletion of big files...

Alexander Viro (viro@math.psu.edu)
Sat, 15 May 1999 12:33:37 -0400 (EDT)


On Fri, 14 May 1999, Jorge Gonzalez Villalonga wrote:

> Hi folks,
>
> I have noticed that when I delete a big file (say 800MB), with a rm
> command, for example, the rm command does not return until the file has
> been deleted (or so it seems). With small files, this is almost
> inmediate, but with files which are say 800 megs in size, this can
> easily be 10 seconds (_seconds_, it's right) till I get the prompt
> again, on a P2-333.
>
> In other Unices, like IRIX, the rm command returns _inmediately_, no
> matter the size of the file.
>
> Looks to me like the unlink syscall is somewhat synchronous, and it
> shouldn't, or does it? For this concrete issue, it could be easily

It's not sys_unlink() per se - it's last fput(). Yes, in many cases it
happens within sys_unlink(). We could change this behaviour, but there is
one problem: instead of passing process credentials (as it is done in BSD
and derivatives) Linux looks at the credentials of current process. So we
can't pass the final reaping to a daemon (think quotas) and we have slow
truncate(), so it takes a lot of time. Look through l-k archives - it was
discussed many times.

> solved by the unlink syscall starting a thread to unlink the big file,
> while the rest of the system keeps running normally. But I suppose it's

Ahem... Normally?
cp -a /usr/src/linux foo;echo 'Look, mom - load average over 5000';rm -rf foo

-
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/