Skip to content
Commit d76d1815 authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

svcrpc: avoid double reply caused by deferral race

Commit d29068c4

 "sunrpc: Simplify cache_defer_req and related
functions." asserted that cache_check() could determine success or
failure of cache_defer_req() by checking the CACHE_PENDING bit.

This isn't quite right.

We need to know whether cache_defer_req() created a deferred request,
in which case sending an rpc reply has become the responsibility of the
deferred request, and it is important that we not send our own reply,
resulting in two different replies to the same request.

And the CACHE_PENDING bit doesn't tell us that; we could have
succesfully created a deferred request at the same time as another
thread cleared the CACHE_PENDING bit.

So, partially revert that commit, to ensure that cache_check() returns
-EAGAIN if and only if a deferred request has been created.

Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Acked-by: default avatarNeilBrown <neilb@suse.de>
parent 3beb6cd1
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