The current API to get if a command is present in the active
queue was executed without the lock acquired. Here, at times
we get the queue size as one, and when we actually get the command
from the active queue, we get nothing.
This could be that the command from the active queue was removed
in another context almost at the same time, when we trying to read
the command from the active queue.
To avoid this, we do the operation of reading the queue size and
reading from the active queue with the queue locks held, so no
other context could remove the command from the active queue while
we are reading the command from the active queue.
CRs-Fixed: 2644038
Change-Id: Icca019320b1ba2d7d751432142b9bad50519d701