Fixes image delete and upload contention

If an image upload completes during a delete on the same
image, the image data may not be deleted. This patch
resolves this issue and provides a unit test to test it.

Co-authored-by: Hirofumi Ichihara <ichihara.hirofumi@lab.ntt.co.jp>
Change-Id: I913cd3e4963b7b60da6a856eb820c1afcc9017d7
Fixes: bug 1245099
Merge "Fixes image delete and upload contention"