summary refs log tree commit diff
path: root/drivers/scsi/hpsa.h
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2013-09-23 13:34:12 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-12-19 07:38:56 -0800
commit0390f0c0dfb540149d7369276b17ec53caf506cb (patch)
tree2a621fff7b52ca27a9e1a66c168b940d599222f2 /drivers/scsi/hpsa.h
parente06c8e5c34498d1ea0468401012be8d1c853c585 (diff)
downloadlinux-0390f0c0dfb540149d7369276b17ec53caf506cb.tar.gz
[SCSI] hpsa: cap CCISS_PASSTHRU at 20 concurrent commands.
Cap CCISS_BIG_PASSTHRU as well.  If an attempt is made
to exceed this, ioctl() will return -1 with errno == EAGAIN.

This is to prevent a userland program from exhausting all of
pci_alloc_consistent memory.  I've only seen this problem when
running a special test program designed to provoke it.  20
concurrent commands via the passthru ioctls (not counting SG_IO)
should be more than enough.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/hpsa.h')
-rw-r--r--drivers/scsi/hpsa.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index bc85e7244f40..6eabf08ca672 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -114,6 +114,11 @@ struct ctlr_info {
 	struct TransTable_struct *transtable;
 	unsigned long transMethod;
 
+	/* cap concurrent passthrus at some reasonable maximum */
+#define HPSA_MAX_CONCURRENT_PASSTHRUS (20)
+	spinlock_t passthru_count_lock; /* protects passthru_count */
+	int passthru_count;
+
 	/*
 	 * Performant mode completion buffers
 	 */