summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-06-13 12:53:42 +1000
committerJ. Bruce Fields <bfields@redhat.com>2013-07-01 17:42:53 -0400
commitf9e1aedc6c79f18bb56caa3735b94217c4ec1e0c (patch)
tree41ccb179f3d71ded6d035f3bc292f752c32f6995 /Documentation
parentd08d32e6e5c0fee127d3b20d70f5b59d8af0a261 (diff)
downloadlinux-f9e1aedc6c79f18bb56caa3735b94217c4ec1e0c.tar.bz2
sunrpc/cache: remove races with queuing an upcall.
We currently queue an upcall after setting CACHE_PENDING, and dequeue after clearing CACHE_PENDING. So a request should only be present when CACHE_PENDING is set. However we don't combine the test and the enqueue/dequeue in a protected region, so it is possible (if unlikely) for a race to result in a request being queued without CACHE_PENDING set, or a request to be absent despite CACHE_PENDING. So: include a test for CACHE_PENDING inside the regions of enqueue and dequeue where queue_lock is held, and abort the operation if the value is not as expected. Also remove the early 'return' from cache_dequeue() to ensure that it always removes all entries: As there is no locking between setting CACHE_PENDING and calling sunrpc_cache_pipe_upcall it is not inconceivable for some other thread to clear CACHE_PENDING and then someone else to set it and call sunrpc_cache_pipe_upcall, both before the original threads completed the call. With this, it perfectly safe and correct to: - call cache_dequeue() if and only if we have just cleared CACHE_PENDING - call sunrpc_cache_pipe_upcall() (via cache_make_upcall) if and only if we have just set CACHE_PENDING. Reported-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions