Skip to contentSkip to conversation

target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN

PATCH Applied Bodo Stroesser 3 participants 3 messages Apr 9, 2020 – Apr 13, 2020

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

PATCH 1/1 target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN

In case command ring buffer becomes inconsistent, tcmu sets device flag TCMU_DEV_BIT_BROKEN.
If the bit is set, tcmu rejects new commands from lio core with TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, and no longer processes completions from the ring.
The reset_ring attribute can be used to completely clean up the command ring, so after reset_ring the ring no longer is inconsistent.

Therefore reset_ring also should reset bit TCMU_DEV_BIT_BROKEN to allow normal processing.

---
 drivers/target/target_core_user.c | 1 +
 1 file changed, 1 insertion(+)
drivers/target/target_core_user.c +1 -0
index 0b9dfa6b17bc..f769bb1e3735 100644
@@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level)
 	mb->cmd_tail = 0;
 	mb->cmd_head = 0;
 	tcmu_flush_dcache_range(mb, sizeof(*mb));
+	clear_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
 
 	del_timer(&udev->cmd_timer);
 
Signature · 1 line
2.12.3
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Bodo Stroesser

In case command ring buffer becomes inconsistent, tcmu sets device flag TCMU_DEV_BIT_BROKEN.
If the bit is set, tcmu rejects new commands from lio core with TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, and no longer processes completions from the ring.
The reset_ring attribute can be used to completely clean up the command ring, so after reset_ring the ring no longer is inconsistent.

Therefore reset_ring also should reset bit TCMU_DEV_BIT_BROKEN to allow normal processing.

---
 drivers/target/target_core_user.c | 1 +
 1 file changed, 1 insertion(+)
drivers/target/target_core_user.c +0 -0
index 0b9dfa6b17bc..f769bb1e3735 100644

drivers/target/target_core_user.c static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) · line 2079

Quoted 7 lines
drivers/target/target_core_user.c +1 -0
@@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level)
 	mb->cmd_tail = 0;
 	mb->cmd_head = 0;
 	tcmu_flush_dcache_range(mb, sizeof(*mb));
+	clear_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
 
 	del_timer(&udev->cmd_timer);
 
#2 lore raw
In reply to Bodo Stroesser

Bodo,

Quoted 9 lines

In case command ring buffer becomes inconsistent, tcmu sets device flag TCMU_DEV_BIT_BROKEN. If the bit is set, tcmu rejects new commands from lio core with TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, and no longer processes completions from the ring. The reset_ring attribute can be used to completely clean up the command ring, so after reset_ring the ring no longer is inconsistent.

Therefore reset_ring also should reset bit TCMU_DEV_BIT_BROKEN to allow normal processing.

Applied to 5.7/scsi-fixes, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering