2003-08-10 13:30:15

by Frederick, Fabian

[permalink] [raw]
Subject: [PATCH ?] iprune_sem

Hi,

Someone could tell me why we don't use iprune_sem in get_new_inode
like this ?
http://fabian.unixtech.be/kernel/inode060803.diff


Regards,
Fabian


2003-08-11 16:16:58

by Hugh Dickins

[permalink] [raw]
Subject: Re: [PATCH ?] iprune_sem

On Sun, 10 Aug 2003, Frederick, Fabian wrote:
>
> Someone could tell me why we don't use iprune_sem in get_new_inode
> like this ?
> http://fabian.unixtech.be/kernel/inode060803.diff

1. iprune_sem was introduced for a specific umount versus prune race,
see the comment upon it: no bearing on get_new_inode whatsoever.
2. How would downing a semaphore just before the spin_lock,
upping it just after the spin_unlock, serve any purpose?
3. If it were useful, it should be upped on the exceptional path too.
4. Don't change "locked inode" comment to "inode unlocked": I_LOCK is set.
5. But worst of all, you remove the whole point of the old = find_inode.

I think you're trying to say, a semaphore (not placed where you have it)
could be used to prevent two tasks from allocating the same inode at the
same time. Yes, but would single-thread inode allocation disastrously:
much more efficient for both to try and check - as get_new_inode does.

Hugh