aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/scsi_lib.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 26a57faf885b..fc0a8a0c0a34 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -22,6 +22,7 @@
22#include <linux/hardirq.h> 22#include <linux/hardirq.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/blk-mq.h> 24#include <linux/blk-mq.h>
25#include <linux/ratelimit.h>
25 26
26#include <scsi/scsi.h> 27#include <scsi/scsi.h>
27#include <scsi/scsi_cmnd.h> 28#include <scsi/scsi_cmnd.h>
@@ -1038,18 +1039,25 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
1038 switch (action) { 1039 switch (action) {
1039 case ACTION_FAIL: 1040 case ACTION_FAIL:
1040 /* Give up and fail the remainder of the request */ 1041 /* Give up and fail the remainder of the request */
1041 if (unlikely(scsi_logging_level)) 1042 if (!(req->cmd_flags & REQ_QUIET)) {
1042 level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT, 1043 static DEFINE_RATELIMIT_STATE(_rs,
1043 SCSI_LOG_MLQUEUE_BITS); 1044 DEFAULT_RATELIMIT_INTERVAL,
1044 /* 1045 DEFAULT_RATELIMIT_BURST);
1045 * if logging is enabled the failure will be printed 1046
1046 * in scsi_log_completion(), so avoid duplicate messages 1047 if (unlikely(scsi_logging_level))
1047 */ 1048 level = SCSI_LOG_LEVEL(SCSI_LOG_MLCOMPLETE_SHIFT,
1048 if (!level && !(req->cmd_flags & REQ_QUIET)) { 1049 SCSI_LOG_MLCOMPLETE_BITS);
1049 scsi_print_result(cmd, NULL, FAILED); 1050
1050 if (driver_byte(result) & DRIVER_SENSE) 1051 /*
1051 scsi_print_sense(cmd); 1052 * if logging is enabled the failure will be printed
1052 scsi_print_command(cmd); 1053 * in scsi_log_completion(), so avoid duplicate messages
1054 */
1055 if (!level && __ratelimit(&_rs)) {
1056 scsi_print_result(cmd, NULL, FAILED);
1057 if (driver_byte(result) & DRIVER_SENSE)
1058 scsi_print_sense(cmd);
1059 scsi_print_command(cmd);
1060 }
1053 } 1061 }
1054 if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0)) 1062 if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0))
1055 return; 1063 return;