cciss: Ignore stale commands after reboot

When doing an unexpected shutdown like kexec the cciss
firmware might still have some commands in flight, which
it is trying to complete.
The driver is doing it's best on resetting the HBA,
but sadly there's a firmware issue causing the firmware
_not_ to abort or drop old commands.
So the firmware will send us commands which we haven't
accounted for, causing the driver to panic.

With this patch we're just ignoring these commands as
there is nothing we could be doing with them anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@carl.(none)>

authored by Hannes Reinecke and committed by Jens Axboe b59e64d0 d960eea9

+14 -2
+13 -2
drivers/block/cciss.c
··· 226 227 static inline void removeQ(CommandList_struct *c) 228 { 229 - if (WARN_ON(hlist_unhashed(&c->list))) 230 return; 231 232 hlist_del_init(&c->list); 233 } ··· 4256 while (!hlist_empty(&h->cmpQ)) { 4257 c = hlist_entry(h->cmpQ.first, CommandList_struct, list); 4258 removeQ(c); 4259 - c->err_info->CommandStatus = CMD_HARDWARE_ERR; 4260 if (c->cmd_type == CMD_RWREQ) { 4261 complete_command(h, c, 0); 4262 } else if (c->cmd_type == CMD_IOCTL_PEND)
··· 226 227 static inline void removeQ(CommandList_struct *c) 228 { 229 + /* 230 + * After kexec/dump some commands might still 231 + * be in flight, which the firmware will try 232 + * to complete. Resetting the firmware doesn't work 233 + * with old fw revisions, so we have to mark 234 + * them off as 'stale' to prevent the driver from 235 + * falling over. 236 + */ 237 + if (WARN_ON(hlist_unhashed(&c->list))) { 238 + c->cmd_type = CMD_MSG_STALE; 239 return; 240 + } 241 242 hlist_del_init(&c->list); 243 } ··· 4246 while (!hlist_empty(&h->cmpQ)) { 4247 c = hlist_entry(h->cmpQ.first, CommandList_struct, list); 4248 removeQ(c); 4249 + if (c->cmd_type != CMD_MSG_STALE) 4250 + c->err_info->CommandStatus = CMD_HARDWARE_ERR; 4251 if (c->cmd_type == CMD_RWREQ) { 4252 complete_command(h, c, 0); 4253 } else if (c->cmd_type == CMD_IOCTL_PEND)
+1
drivers/block/cciss_cmd.h
··· 274 #define CMD_SCSI 0x03 275 #define CMD_MSG_DONE 0x04 276 #define CMD_MSG_TIMEOUT 0x05 277 278 /* This structure needs to be divisible by 8 for new 279 * indexing method.
··· 274 #define CMD_SCSI 0x03 275 #define CMD_MSG_DONE 0x04 276 #define CMD_MSG_TIMEOUT 0x05 277 + #define CMD_MSG_STALE 0xff 278 279 /* This structure needs to be divisible by 8 for new 280 * indexing method.