[SCSI] hpsa: do not attempt to flush the cache on locked up controllers
authorStephen M. Cameron <scameron@beardog.cce.hp.com>
Mon, 23 Sep 2013 18:33:30 +0000 (13:33 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 16 Dec 2013 18:57:52 +0000 (10:57 -0800)
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 <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/hpsa.c

index 20a5e6ecf945fab55a982840d6921046b4c552bf..c3db9bb1c235e266a3e70812b4b2921733c97c6e 100644 (file)
@@ -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)