summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
authorJulian Wiedmann <jwi@linux.ibm.com>2020-10-28 21:30:50 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2020-10-30 05:17:01 +0300
commitefd321768d2e0e85083b83aefb15c949d4c8930f (patch)
tree66dd13943d24814ee123f9761a9505ab41a0ce87 /drivers/s390/scsi
parent84e7b4169f949f8185a5adf0f0bfb893030d0fda (diff)
downloadlinux-efd321768d2e0e85083b83aefb15c949d4c8930f.tar.xz
scsi: zfcp: Clarify & assert the stat_lock locking in zfcp_qdio_send()
Explain why the plain spin_lock() suffices in current code, even when the stat_lock is also used by zfcp_qdio_int_req() in tasklet context. We could also promote the spin_lock() to a spin_lock_irqsave(), but that would just obfuscate the locking even further. Link: https://lore.kernel.org/r/b023b1472630f4bf9fce580577d7bb49de89ccbf.1603908167.git.bblock@linux.ibm.com Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Reviewed-by: Steffen Maier <maier@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 9fc045ddf66d..23ab16d65f2a 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -10,6 +10,7 @@
#define KMSG_COMPONENT "zfcp"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+#include <linux/lockdep.h>
#include <linux/slab.h>
#include <linux/module.h>
#include "zfcp_ext.h"
@@ -283,6 +284,13 @@ int zfcp_qdio_send(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
int retval;
u8 sbal_number = q_req->sbal_number;
+ /*
+ * This should actually be a spin_lock_bh(stat_lock), to protect against
+ * zfcp_qdio_int_req() in tasklet context.
+ * But we can't do so (and are safe), as we always get called with IRQs
+ * disabled by spin_lock_irq[save](req_q_lock).
+ */
+ lockdep_assert_irqs_disabled();
spin_lock(&qdio->stat_lock);
zfcp_qdio_account(qdio);
spin_unlock(&qdio->stat_lock);