Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] libsas: introduce scmd_dbg() to quiet false positive "timeout" messages

libsas sometimes short circuits timeouts to force commands into error
recovery. It is misleading to log that the command timed-out in
sas_scsi_timed_out() when in fact it was just queued for error handling.
It's also redundant in the case of a true timeout as libata eh will
detect and report timeouts via it's AC_ERR_TIMEOUT facility.

Given that some environments consider "timeout" errors to be indicative
of impending device failure demote the sas_scsi_timed_out() timeout
message to be disabled by default. This parallels ata_scsi_timed_out().

[jejb: checkpatch fix]
Reported-by: Xun Ni <xun.ni@intel.com>
Tested-by: Nelson Cheng <nelson.cheng@intel.com>
Acked-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Dan Williams and committed by
James Bottomley
3af74a3c 4440e46d

+13 -1
+1 -1
drivers/scsi/libsas/sas_scsi_host.c
··· 862 862 863 863 enum blk_eh_timer_return sas_scsi_timed_out(struct scsi_cmnd *cmd) 864 864 { 865 - scmd_printk(KERN_DEBUG, cmd, "command %p timed out\n", cmd); 865 + scmd_dbg(cmd, "command %p timed out\n", cmd); 866 866 867 867 return BLK_EH_NOT_HANDLED; 868 868 }
+12
include/scsi/scsi_device.h
··· 235 235 #define sdev_printk(prefix, sdev, fmt, a...) \ 236 236 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) 237 237 238 + #define sdev_dbg(sdev, fmt, a...) \ 239 + dev_dbg(&(sdev)->sdev_gendev, fmt, ##a) 240 + 238 241 #define scmd_printk(prefix, scmd, fmt, a...) \ 239 242 (scmd)->request->rq_disk ? \ 240 243 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \ 241 244 (scmd)->request->rq_disk->disk_name, ##a) : \ 242 245 sdev_printk(prefix, (scmd)->device, fmt, ##a) 246 + 247 + #define scmd_dbg(scmd, fmt, a...) \ 248 + do { \ 249 + if ((scmd)->request->rq_disk) \ 250 + sdev_dbg((scmd)->device, "[%s] " fmt, \ 251 + (scmd)->request->rq_disk->disk_name, ##a);\ 252 + else \ 253 + sdev_dbg((scmd)->device, fmt, ##a); \ 254 + } while (0) 243 255 244 256 enum scsi_target_state { 245 257 STARGET_CREATED = 1,