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-Tag: firefly_0821_release~176^2~4607^2^2~66 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=702890e3b910cd14c3d0ee3b4842d7e946e66b8d;p=firefly-linux-kernel-4.4.55.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)