orchestrator: Fix rolling update race that could create extra tasks
orchestrator: Fix rolling update race that could create extra tasks

The updateTask method atomically shuts down a task and replaces it with
a new one. Calls to updateTask are queued through a channel, and this
happens outside a channel. It's possible that once updateTask is called,
the old task has already been shut down. In this case, shutting down the
task is a no-op, but creating a task adds a new task that shouldn't
exist, and puts us in a bad state. We need to check that the task hasn't
already been shut down to avoid this problem.

Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a4c351b604@docker.com>

yongtang/swarmkit,Noyan759/swarmkit,aaronlehmann/swarmkit,elifa/swarmkit,aaronlehmann/swarmkit,alyyousuf7/swarmkit,AliyunContainerService/swarmkit,fate-grand-order/swarmkit,yp-engineering/swarmkit,Noyan759/swarmkit,deljuven/swarmkit,cheyang/swarmkit,jlhawn/swarmkit,alyyousuf7/swarmkit,sungwonh/swarmkit,AliyunContainerService/swarmkit,fate-grand-order/swarmkit,diogomonica/swarmkit,RenaudWasTaken/swarmkit,elifa/swarmkit,allencloud/swarmkit,vasil-yordanov/swarmkit,yongtang/swarmkit,cezarsa/swarmkit,deljuven/swarmkit,allencloud/swarmkit,sungwonh/swarmkit,vasil-yordanov/swarmkit,RenaudWasTaken/swarmkit,docker/swarmkit,cezarsa/swarmkit,diogomonica/swarmkit,dperny/swarmkit-1,jlhawn/swarmkit,docker/swarmkit,dperny/swarmkit-1,yp-engineering/swarmkit,cheyang/swarmkit