uas: zap_pending: data urbs should have completed at this time
authorHans de Goede <hdegoede@redhat.com>
Sat, 13 Sep 2014 10:26:37 +0000 (12:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 04:42:11 +0000 (21:42 -0700)
The data urbs are all killed before calling zap_pending, and their completion
handler should have cleared their inflight flag.

Do not 0 the data inflight flags, and add a check for try_complete succeeding,
as it should always succeed when called from zap_pending.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/uas.c

index dd8772b60ab8ba5290967f9f71c1c74386e8d6b3..7daecd59cd38505a916fb319a870af8b9e36dc00 100644 (file)
@@ -145,6 +145,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)
        struct uas_cmd_info *cmdinfo;
        struct uas_cmd_info *temp;
        unsigned long flags;
+       int err;
 
        spin_lock_irqsave(&devinfo->lock, flags);
        list_for_each_entry_safe(cmdinfo, temp, &devinfo->dead_list, list) {
@@ -152,12 +153,11 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)
                struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd,
                                                      SCp);
                uas_log_cmd_state(cmnd, __func__);
-               /* all urbs are killed, clear inflight bits */
-               cmdinfo->state &= ~(COMMAND_INFLIGHT |
-                                   DATA_IN_URB_INFLIGHT |
-                                   DATA_OUT_URB_INFLIGHT);
+               /* Sense urbs were killed, clear COMMAND_INFLIGHT manually */
+               cmdinfo->state &= ~COMMAND_INFLIGHT;
                cmnd->result = result << 16;
-               uas_try_complete(cmnd, __func__);
+               err = uas_try_complete(cmnd, __func__);
+               WARN_ON(err != 0);
        }
        spin_unlock_irqrestore(&devinfo->lock, flags);
 }