Commit 397cb380 authored by Wensong Zhang's avatar Wensong Zhang Committed by David S. Miller

[IPVS]: Fix to hold the lock before updating a service

Brett E. <brettspamacct@fastclick.com> noticed the missing service lock
for editing dest.

Julian Anastasov <ja@ssi.bg> provided the patch.
parent 79785e24
...@@ -898,9 +898,16 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) ...@@ -898,9 +898,16 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
__ip_vs_update_dest(svc, dest, udest); __ip_vs_update_dest(svc, dest, udest);
write_lock_bh(&__ip_vs_svc_lock);
/* Wait until all other svc users go away */
while (atomic_read(&svc->usecnt) > 1) {};
/* call the update_service, because server weight may be changed */ /* call the update_service, because server weight may be changed */
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);
write_unlock_bh(&__ip_vs_svc_lock);
LeaveFunction(2); LeaveFunction(2);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment