summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-09-13 12:26:42 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-23 21:42:11 -0700
commitf9dc024a2da1fe6b0ce180b89fac085e1255a932 (patch)
tree839617e87a348768dd0eb94922968831a5919f9d /init
parent4c5481efb4346948ba7034432f86235a16ac9180 (diff)
uas: pre_reset and suspend: Fix a few races
The purpose of uas_pre_reset is to: 1) Stop any new commands from being submitted while an externally triggered usb-device-reset is running 2) Wait for any pending commands to finish before allowing the usb-device-reset to continue The purpose of uas_suspend is to: 2) Wait for any pending commands to finish before suspending This commit fixes races in both paths: 1) For 1) we use scsi_block_requests, but the scsi midlayer calls queuecommand without holding any locks, so a queuecommand may already past the midlayer scsi_block_requests checks when we call it, add a check to uas_queuecommand to fix this 2) For 2) we were waiting for all sense-urbs to complete, there are 2 problems with this approach: a) data-urbs may complete after the sense urb, so we need to check for those too b) if a sense-urb completes with a iu id of READ/WRITE_READY a command is not yet done. We submit a new sense-urb immediately in this case, but that submit may fail (in which case it will get retried by uas_do_work), if this happens the sense_urbs anchor may become empty while the cmnd is not yet done Also unblock requests on timeout, to avoid things getting stuck in that case. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions