• Tejun Heo's avatar
    libata: retry failed FLUSH if device didn't fail it · 6013efd8
    Tejun Heo authored
    If ATA device failed FLUSH, it means that the device failed to write
    out some amount of data and the error needs to be reported to upper
    layers. As retries can't recover the lost data, FLUSH failures need to
    be reported immediately in general.
    
    However, if FLUSH fails due to transmission errors, the FLUSH needs to
    be retried; otherwise, filesystems may switch to RO mode and/or raid
    array may drop a drive for a random transmission glitch.
    
    This condition can be rather easily reproduced on certain ahci
    controllers which go through a PHY event after powersave mode switch +
    ext4 combination.  Powersave mode switch is often closely followed by
    flush from the filesystem failing the FLUSH with ATA bus error which
    makes the filesystem code believe that data is lost and drop to RO
    mode.  This was reported in the following bugzilla bug.
    
      http://bugzilla.kernel.org/show_bug.cgi?id=14543
    
    This patch makes libata EH retry FLUSH if it wasn't failed by the
    device.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reported-by: default avatarAndrey Vihrov <andrey.vihrov@gmail.com>
    Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
    6013efd8
libata-eh.c 98.9 KB