• James Bottomley's avatar
    [SCSI] scsi_lib: don't decrement busy counters when inserting commands · 4f5299ac
    James Bottomley authored
    A bug was introduced by
    commit b60af5b0
    Author: Alan Stern <stern@rowland.harvard.edu>
    Date:   Mon Nov 3 15:56:47 2008 -0500
        [SCSI] simplify scsi_io_completion()
    because the simplification uses scsi_queue_insert().  The problem with
    this function is that it expects to be called from the completion path
    while the command is still outstanding, so it decrements the device
    and host busy counts to do the requeue.  The problem is that
    scsi_io_completion() is a path executed well after these counts have
    *already* been decremented, leading to a double decrement if the
    command goes down any error path leading to ACTION_DELAYED_RETRY.
    The fix is to allow a private function __scsi_queue_insert() with a
    flag to say whether the busy counters should be decremented.  This is
    made static to scsi_lib.c to discourage other use.
    Reported-by: default avatarMike Christie <michaelc@cs.wisc.edu>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
scsi_lib.c 69 KB