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 226 227 227 static inline void removeQ(CommandList_struct *c) 228 228 { 229 - if (WARN_ON(hlist_unhashed(&c->list))) 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; 230 239 return; 240 + } 231 241 232 242 hlist_del_init(&c->list); 233 243 } ··· 4256 4246 while (!hlist_empty(&h->cmpQ)) { 4257 4247 c = hlist_entry(h->cmpQ.first, CommandList_struct, list); 4258 4248 removeQ(c); 4259 - c->err_info->CommandStatus = CMD_HARDWARE_ERR; 4249 + if (c->cmd_type != CMD_MSG_STALE) 4250 + c->err_info->CommandStatus = CMD_HARDWARE_ERR; 4260 4251 if (c->cmd_type == CMD_RWREQ) { 4261 4252 complete_command(h, c, 0); 4262 4253 } else if (c->cmd_type == CMD_IOCTL_PEND)
+1
drivers/block/cciss_cmd.h
··· 274 274 #define CMD_SCSI 0x03 275 275 #define CMD_MSG_DONE 0x04 276 276 #define CMD_MSG_TIMEOUT 0x05 277 + #define CMD_MSG_STALE 0xff 277 278 278 279 /* This structure needs to be divisible by 8 for new 279 280 * indexing method.