Subject: Re: funlink() for fun!
To: Matthias Buelow <>
From: Greg A. Woods <>
List: tech-kern
Date: 07/12/2003 04:54:01
[ On Saturday, July 12, 2003 at 03:53:44 (+0200), Matthias Buelow wrote: ]
> Subject: Re: funlink() for fun!
> I addition, the only proper semantics for an funlink() system call I
> could see would be to set the reference counter in the inode to zero,

No, not zero -- just decremented by one (assuming the proper directory
entry can be found).

> close/invalidate the file and all descriptors to it and have the
> kernel

No, absolutely NOT!  unlink() doesn't to this for VERY good reasons, and
funlink() could not do so either.

> some external process or fsck at reboot remove all references
> from directories.

as I say in my other reply this is impossible to do safely without
locking the whole filesystem (or unmounting it or going to single-user
mode and assuming the admin is clueful).

Forcing the user of funlink() to suffer through an internal ftw() and
still risk a failure if the link count is not exactly one is one thing,
but forcing the whole system to do without a filesystem for the time it
takes to fsck it would be ludicrous.

>  It would indeed delete the file, not a
> directory entry, which is literally what the caller requested.

That's completely wrong given how I've described funlink().

								Greg A. Woods

+1 416 218-0098;            <>;           <>
Planix, Inc. <>; VE3TCP; Secrets of the Weird <>