• James Bottomley's avatar
    [PATCH] first cut at fixing unable to requeue with no outstanding · e7d2d832
    James Bottomley authored
     commands
    
    The attached represents an attempt to break the scsi mid-layer of the 
    assumption that any device can queue at least one command.
    
    What essentially happens if the host rejects a command with no other 
    outstanding commands, it does a very crude countdown (basically counts the 
    number of cycles through the scsi request function) until the device gets 
    enabled again when the count reaches zero.  I think the iteration in the 
    request function is better than a fixed timer because it makes the system more 
    responsive to I/O pressure (and also, it's easier to code).
    
    I've tested this by making a SCSI driver artificially reject commands with 
    none outstanding (and run it on my root device).  A value of seven seems to 
    cause a delay of between half and five seconds before the host starts up again 
    (depending on the I/O load).
    
    If this approach looks acceptable, I plan the following enhancements
    
    1. Make device_busy count down in the same fashion
    2. give ->queuecommand() a two value return (one for blocking the entire host 
    and another for just blocking the device).
    3. Make the countdown tuneable from the host template.
    e7d2d832
hosts.h 21.1 KB