Re: [PATCH 4/4] posix-timers: turn it_signal into it_valid flag

From: Thomas Gleixner
Date: Fri Sep 02 2011 - 10:19:14 EST


On Fri, 2 Sep 2011, Eric Dumazet wrote:

> Le vendredi 02 septembre 2011 Ã 12:06 +0200, Thomas Gleixner a Ãcrit :
>
> > ------------------>
> > Subject: posix-timers: Simplify deletion protection
> > From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Date: Fri, 02 Sep 2011 11:59:14 +0200
> >
> > k_itimer->it_signal is soleley used to protect a timer lookup against
> > a concurrent deletion. We can use k_itimer->list for the same purpose.
> >
>
> Well, this patch is wrong too, unless you base it after Andi patch 1/4
> (move global timer id management to signal_struct)

I know, it's not for the current code.

> The test is also present to make sure one process doesnt try to use a
> timer_id of another process.

Right, but after moving the idr into sig struct it's only purpose is
to protect against deletion, which is nicely covered by the list_head
check as well.

Thanks,

tglx

>
> > @@ -643,7 +643,7 @@ static struct k_itimer *__lock_timer(tim
> > timr = idr_find(&posix_timers_id, (int)timer_id);
> > if (timr) {
> > spin_lock_irqsave(&timr->it_lock, *flags);
> > - if (timr->it_signal == current->signal) {
> > + if (!list_empty(&timr->list)) {
> > rcu_read_unlock();
> > return timr;
> > }
>
>
>
>