← Back to archive

Daily update · Aug 12–13, 2026

SCSI error handling: race, deadlock, and scsi_debug fixes

Two SCSI core patches address error-handling hazards; scsi_debug's compare-and-write is fixed.

In brief

A batch of SCSI core fixes targets error-handling paths: one closes a race between power management and error handling, another avoids a possible deadlock when the error handler tries to lock the door while all command tags are busy. A separate fix corrects a logic error in the scsi_debug test driver's compare-and-write emulation.

Bug fixes

Pair runtime PM get/put in SCSI error handling

In the SCSI error handler, the decision to resume the host (scsi_autopm_get_host) and later release it (scsi_autopm_put_host) each checked a separate flag, shost->eh_noresume. When a power-management error path changed that flag mid-iteration, the get could be skipped while the put still ran, leaving the PM reference count unbalanced. The patch makes the get and put happen as a pair so this race cannot occur.

Why it matters: Prevents unbalanced runtime power-management calls during error recovery, which could otherwise leave a device in the wrong power state.

872f486259ae

Avoid blocking on tag allocation in scsi_eh_lock_door()

scsi_eh_lock_door() runs while the host is still in recovery and before its queues are restarted. It allocates a request, which can block waiting for a free tag. But tags may be held by commands that were requeued during error handling and cannot be dispatched until after lock_door returns, creating a circular wait. The fix prevents that blocking allocation.

Why it matters: Removes a potential deadlock that could stall SCSI error recovery when all command slots are occupied.

732cb6bb37fd

Fix scsi_debug compare-and-write for wrapped buffers

In the scsi_debug driver, comp_write_worker() returns whether the compared data matches. The first segment correctly used !memcmp(), but the wrapped segment used memcmp() directly, so the match result was inverted when the compare crossed the end of the test buffer. The patch applies the same negation.

Why it matters: Makes scsi_debug's compare-and-write emulation report correct results for tests that wrap around, avoiding false failures in storage test suites.

c4f6916a99cf

Source commits3 entries +
732cb6bb37fd

scsi: core: Do not block on tag allocation in scsi_eh_lock_door()

Zizhi Wo · Jul 23, 2026 · 1 files

872f486259ae

scsi: core: pair EH runtime PM get and put

Hongjie Fang · Jul 29, 2026 · 3 files

c4f6916a99cf

scsi: scsi_debug: Negate wrapped memcmp() result

Xu Rao · Aug 3, 2026 · 1 files