net: Make check_next_chunk() mutually exclusive
Since
4004285311 ("Fix the race in data_finished() and resp_finished()"),
Although the possibility of a race between two threads executing
data_finished() and resp_finished() is reduced, it is still possible
to enter the check_next_chunk() function at the same time in certain
circumstances as below:
Thread A | Thread B
-------------------------------------------------+--------------------------------------------------------------
| chunk->resp_finished = 1;
chunk->data_finished = 1; |
if (chunk->resp_finished) |
check_next_chunk(chunk, transfer); |
chunk->chunk_number = transfer->chunk_number++; |
| if (chunk->data_finished)
| check_next_chunk(chunk, transfer);
| >> chunk->chunk_number = transfer->chunk_number++;
| <chunk_number becomes unmatched>
chunk->data_finished = chunk->resp_finished = 0; |
…
To address this, this makes the functions completely mutually exclusive.
Change-Id: I94df217ec82dadc322050693e86763f9c8213d05
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>