Re: Socket locking

Andi Kleen (ak@muc.de)
04 Oct 1997 19:48:03 +0200


Bill Hawes <whawes@star.net> writes:

> Alan Cox wrote:
> > Is the inode semaphore interrupt safe ?
>
> It's a MUTEX, so it's supposed to be interrupt safe. On the other hand,
> we probably don't want code running in an interrupt context to be
> blocked by a semaphore. This may make it tricky to determine what uses
> should be protected by the semaphore ..

I think that's no problem. The only interrupt involved in packet output
is the timer - and it only does:

if (sk->sock_readers) wait another second

This could just be replaced with

if (sk->sock_readers || sem_trylock(inode->i_sem))
wait another second

For input processing it's different, for this sock_readers is good.

-Andi