Skip to contentSkip to conversation

nvmet-tcp: use 'spin_lock_bh' for state_lock()

PATCH Applied Hannes Reinecke 2 participants 4 messages Oct 12, 2023 – Oct 13, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet-tcp: use 'spin_lock_bh' for state_lock()

nvmet_tcp_schedule_release_queue() is called from socket state change callbacks, which may be called from an softirq context. So use 'spin_lock_bh' to avoid a spin lock warning.

---
 drivers/nvme/target/tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +2 -2
index 493645096eca..cd5ef64f1bc9 100644
@@ -1379,7 +1379,7 @@ static void nvmet_tcp_release_queue(struct kref *kref)
 
 static void nvmet_tcp_schedule_release_queue(struct nvmet_tcp_queue *queue)
 {
-	spin_lock(&queue->state_lock);
+	spin_lock_bh(&queue->state_lock);
 	if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {
 		/* Socket closed during handshake */
 		tls_handshake_cancel(queue->sock->sk);
@@ -1388,7 +1388,7 @@ static void nvmet_tcp_schedule_release_queue(struct nvmet_tcp_queue *queue)
 		queue->state = NVMET_TCP_Q_DISCONNECTING;
 		kref_put(&queue->kref, nvmet_tcp_release_queue);
 	}
-	spin_unlock(&queue->state_lock);
+	spin_unlock_bh(&queue->state_lock);
 }
 
 static inline void nvmet_tcp_arm_queue_deadline(struct nvmet_tcp_queue *queue)
Signature · 1 line
2.35.3
maintainer
#1 lore raw
Quoted 3 lines · Hannes Reinecke

nvmet_tcp_schedule_release_queue() is called from socket state change callbacks, which may be called from an softirq context. So use 'spin_lock_bh' to avoid a spin lock warning.

Doh, I missed you already sent this fix:

http://lists.infradead.org/pipermail/linux-nvme/2023-August/041593.html

I can apply it on nvme-6.7, though this feels like a fix that can go in now. Depending on which way we go, it will cause a merge conflict for either stable or the next merge window. Do you have a preference? I'd just do 6.7 if you don't care.

#2 lore raw
Quoted 5 lines · Keith Busch
Quoted 3 lines · Hannes Reinecke

nvmet_tcp_schedule_release_queue() is called from socket state change callbacks, which may be called from an softirq context. So use 'spin_lock_bh' to avoid a spin lock warning.

Quoted 8 lines

Doh, I missed you already sent this fix:

   http://lists.infradead.org/pipermail/linux-nvme/2023-August/041593.html

I can apply it on nvme-6.7, though this feels like a fix that can go in now. Depending on which way we go, it will cause a merge conflict for either stable or the next merge window. Do you have a preference? I'd just do 6.7 if you don't care.

Na, just apply it on top of the TLS patches. That should be fine.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman