tcmu: fix double se_cmd completion
authorMike Christie <mchristi@redhat.com>
Wed, 25 Oct 2017 16:47:15 +0000 (11:47 -0500)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sat, 4 Nov 2017 22:01:55 +0000 (15:01 -0700)
commit0d44374c1aaec7c81b470d3b5f955bc270711f9c
tree338c424b55d9df66a5b313ebd9e0b45856139c7d
parenta271eac46a9a2457f4e8c757f9b7fc92a445cf48
tcmu: fix double se_cmd completion

If cmd_time_out != 0, then tcmu_queue_cmd_ring could end up
sleeping waiting for ring space, timing out and then returning
failure to lio, and tcmu_check_expired_cmd could also detect
the timeout and call target_complete_cmd on the cmd.

This patch just delays setting up the deadline value and adding
the cmd to the udev->commands idr until we have allocated ring
space and are about to send the cmd to userspace.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_user.c