From: Stephen M. Cameron Date: Mon, 23 Sep 2013 18:33:30 +0000 (-0500) Subject: [SCSI] hpsa: do not attempt to flush the cache on locked up controllers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=702890e3b910cd14c3d0ee3b4842d7e946e66b8d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [SCSI] hpsa: do not attempt to flush the cache on locked up controllers There's no point in trying since it can't work, and if you do try, it will just hang the system on shutdown. Signed-off-by: Stephen M. Cameron Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 20a5e6ecf945..c3db9bb1c235 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -4942,6 +4942,15 @@ static void hpsa_flush_cache(struct ctlr_info *h) { char *flush_buf; struct CommandList *c; + unsigned long flags; + + /* Don't bother trying to flush the cache if locked up */ + spin_lock_irqsave(&h->lock, flags); + if (unlikely(h->lockup_detected)) { + spin_unlock_irqrestore(&h->lock, flags); + return; + } + spin_unlock_irqrestore(&h->lock, flags); flush_buf = kzalloc(4, GFP_KERNEL); if (!flush_buf)