Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / scsi / scsi_error.c
index d45c69ca5737b335644fb4490bedf3fd6cf8779c..7ad53fa42766ad597df9b5e0c0739676211c90bc 100644 (file)
@@ -302,7 +302,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
                if (scmd->device->allow_restart &&
                    (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
                        return FAILED;
-               return SUCCESS;
+
+               if (blk_barrier_rq(scmd->request))
+                       /*
+                        * barrier requests should always retry on UA
+                        * otherwise block will get a spurious error
+                        */
+                       return NEEDS_RETRY;
+               else
+                       /*
+                        * for normal (non barrier) commands, pass the
+                        * UA upwards for a determination in the
+                        * completion functions
+                        */
+                       return SUCCESS;
 
                /* these three are not supported */
        case COPY_ABORTED: