Re: [RFC,PATCH] ipvs: Fix race condition in lblb and lblcr schedulers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Simon Horman
Date: Tuesday, August 12, 2008 - 10:42 pm

On Tue, Aug 12, 2008 at 03:07:48PM +0200, Sven Wegener wrote:

Hi Sven,

I think that I am happy with this, except for updating lastuse
under a read lock, is it really safe? Do you still have any concerns?

I've annotated the code with my thoughts on how your locking is working
- thinking aloud if you like.


Setting en->lastuse with a read lock held makes me feel uncomfortable.
Are you sure it is safe?


At this point we know that dest exists and is not in the trash.
We know that dest can't disapear given that its not already
in the trash and our caller holds a read lock on __ip_vs_svc_lock.
So dest will be safe until after ip_vs_lblc_schedule() returns.

Dest seems ok :-)

Ok, that seems complex but non-racy to me :-)

Perhaps a longer comment would be in order.


After the lock is released we may now lose en, but we don't care
as its not used again inside ip_vs_lblc_schedule().

So far so good :-)


This new dest must also not be in the trash by virtue of
being returned by __ip_vs_wlc_schedule() and delitions from
svc->destinations being protected by __ip_vs_svc_lock, which
is held by the caller.

Also good :-)

BTW, the name of __ip_vs_wlc_schedule, really ought to be changed
to __ip_vs_lblc_schedule. I'll make a trivial patch for that.


This write lock looks obviously correct as the destructors
do the same thing.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC,PATCH] ipvs: Fix race condition in lblb and lblcr ..., Simon Horman, (Tue Aug 12, 10:42 pm)