Patch "target: Fix quiese during transport_write_pending_qf endless loop" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    target: Fix quiese during transport_write_pending_qf endless loop

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     target-fix-quiese-during-transport_write_pending_qf-endless-loop.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 9574a497df2bbc0a676b609ce0dd24d237cee3a6 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date: Fri, 29 Sep 2017 16:43:11 -0700
Subject: target: Fix quiese during transport_write_pending_qf endless loop

From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

commit 9574a497df2bbc0a676b609ce0dd24d237cee3a6 upstream.

This patch fixes a potential end-less loop during QUEUE_FULL,
where cmd->se_tfo->write_pending() callback fails repeatedly
but __transport_wait_for_tasks() has already been invoked to
quiese the outstanding se_cmd descriptor.

To address this bug, this patch adds a CMD_T_STOP|CMD_T_ABORTED
check within transport_write_pending_qf() and invokes the
existing se_cmd->t_transport_stop_comp to signal quiese
completion back to __transport_wait_for_tasks().

Cc: Mike Christie <mchristi@xxxxxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: Bryant G. Ly <bryantly@xxxxxxxxxxxxxxxxxx>
Cc: Michael Cyr <mikecyr@xxxxxxxxxxxxxxxxxx>
Cc: Potnuri Bharat Teja <bharat@xxxxxxxxxxx>
Cc: Sagi Grimberg <sagi@xxxxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 drivers/target/target_core_transport.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2575,7 +2575,20 @@ EXPORT_SYMBOL(transport_generic_new_cmd)
 
 static void transport_write_pending_qf(struct se_cmd *cmd)
 {
+	unsigned long flags;
 	int ret;
+	bool stop;
+
+	spin_lock_irqsave(&cmd->t_state_lock, flags);
+	stop = (cmd->transport_state & (CMD_T_STOP | CMD_T_ABORTED));
+	spin_unlock_irqrestore(&cmd->t_state_lock, flags);
+
+	if (stop) {
+		pr_debug("%s:%d CMD_T_STOP|CMD_T_ABORTED for ITT: 0x%08llx\n",
+			__func__, __LINE__, cmd->tag);
+		complete_all(&cmd->t_transport_stop_comp);
+		return;
+	}
 
 	ret = cmd->se_tfo->write_pending(cmd);
 	if (ret) {


Patches currently in stable-queue which might be from nab@xxxxxxxxxxxxxxx are

queue-4.14/target-fix-null-pointer-regression-in-core_tmr_drain_tmr_list.patch
queue-4.14/iscsi-target-make-task_reassign-use-proper-se_cmd-cmd_kref.patch
queue-4.14/target-fix-queue_full-scsi-task-attribute-handling.patch
queue-4.14/target-fix-buffer-offset-in-core_scsi3_pri_read_full_status.patch
queue-4.14/iscsi-target-fix-non-immediate-tmr-reference-leak.patch
queue-4.14/target-fix-caw_sem-leak-in-transport_generic_request_failure.patch
queue-4.14/target-avoid-early-cmd_t_pre_execute-failures-during-abort_task.patch
queue-4.14/target-fix-quiese-during-transport_write_pending_qf-endless-loop.patch



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]