Commit cf3431bba1df3b4f25b04900cb804d7e6e5eb6a9

Authored by Hannes Reinecke
Committed by Martin K. Petersen
1 parent a8bbb2ab4e

scsi: scsi_error: Handle power-on reset unit attention

As per SAM there is a status precedence, with any sense code 29/XX
taking second place just after an ACA ACTIVE status.  Additionally, each
target might prefer to not queue any unit attention conditions, but just
report one.  Due to the above, this will be that one with the highest
precedence.  This results in the sense code 29/XX effectively
overwriting any other unit attention.  Hence we should report the
power-on reset to userland so that it can take appropriate action.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Showing 3 changed files with 12 additions and 1 deletions Side-by-side Diff

drivers/scsi/scsi_error.c
... ... @@ -403,6 +403,12 @@
403 403 "threshold.\n");
404 404 }
405 405  
  406 + if (sshdr->asc == 0x29) {
  407 + evt_type = SDEV_EVT_POWER_ON_RESET_OCCURRED;
  408 + sdev_printk(KERN_WARNING, sdev,
  409 + "Power-on or device reset occurred\n");
  410 + }
  411 +
406 412 if (sshdr->asc == 0x2a && sshdr->ascq == 0x01) {
407 413 evt_type = SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED;
408 414 sdev_printk(KERN_WARNING, sdev,
drivers/scsi/scsi_lib.c
... ... @@ -2743,6 +2743,9 @@
2743 2743 case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
2744 2744 envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
2745 2745 break;
  2746 + case SDEV_EVT_POWER_ON_RESET_OCCURRED:
  2747 + envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
  2748 + break;
2746 2749 default:
2747 2750 /* do nothing */
2748 2751 break;
... ... @@ -2847,6 +2850,7 @@
2847 2850 case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
2848 2851 case SDEV_EVT_LUN_CHANGE_REPORTED:
2849 2852 case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
  2853 + case SDEV_EVT_POWER_ON_RESET_OCCURRED:
2850 2854 default:
2851 2855 /* do nothing */
2852 2856 break;
include/scsi/scsi_device.h
... ... @@ -64,9 +64,10 @@
64 64 SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED, /* 2A 01 UA reported */
65 65 SDEV_EVT_LUN_CHANGE_REPORTED, /* 3F 0E UA reported */
66 66 SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, /* 2A 06 UA reported */
  67 + SDEV_EVT_POWER_ON_RESET_OCCURRED, /* 29 00 UA reported */
67 68  
68 69 SDEV_EVT_FIRST = SDEV_EVT_MEDIA_CHANGE,
69   - SDEV_EVT_LAST = SDEV_EVT_ALUA_STATE_CHANGE_REPORTED,
  70 + SDEV_EVT_LAST = SDEV_EVT_POWER_ON_RESET_OCCURRED,
70 71  
71 72 SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1
72 73 };