[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [Patch] shm bug introduced with pagecache in 2.3.11
From:       Manfred Spraul <manfreds () colorfullife ! com>
Date:       1999-11-20 15:28:14
[Download RAW message or body]

Alan Cox wrote:
> 
> > /* 3 asm instructions */
> > void release_exclusive(struct rw_mutex* rwm)
> > {
> >         read_unlock(&rwm->rwl);
> >         if(rwm->wake_me_up) {
> >                 rwm->wake_me_up = 0;
> >                 wake_up(&rwm->wait);
> >         }
> > }
> 
> That can race with another acquire surely. Suppose they set rmw->wake_me_up
> and we then continue our release and clear it.

But then we call wake_up(), we wake-up the second thread.
Now the second thread either acquires the lock, or it sets the value
back to 1.
This should be OK.

> Actually why do you want the wake_me_up field ?

I thought that would simplify the code. But unfortunately,
write_lock_trylock() is not atomic, and this means my proposal is
impossible.

I'm searching for another solution.
--
	Manfred

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic