Page MenuHomeFreeBSD

iscsi(4) freeze vs action race workaround
ClosedPublic

Authored by trasz on Oct 12 2020, 1:29 PM.
Tags
None
Referenced Files
F82715893: D26750.diff
Wed, May 1, 10:52 PM
Unknown Object (File)
Fri, Apr 26, 6:11 PM
Unknown Object (File)
Fri, Apr 26, 6:10 PM
Unknown Object (File)
Fri, Apr 26, 6:10 PM
Unknown Object (File)
Fri, Apr 26, 12:10 PM
Unknown Object (File)
Mar 21 2024, 8:59 AM
Unknown Object (File)
Dec 20 2023, 3:33 AM
Unknown Object (File)
Dec 11 2023, 2:53 AM

Details

Summary

If the SIM freezes the queue at exactly the wrong moment, after
another thread has started to send in a CCB and already checked
the queue wasn't frozen, we would end up with iscsi_action()
being called despite the queue is now frozen.

Add a check to make sure this doesn't happen. Perhaps this should
be fixed at the CAM level instead, but given how the send queue
and SIM are governed by two separate mutexes, it could be somewhat
hard to do.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34114
Build 31282: arc lint + arc unit

Event Timeline

trasz requested review of this revision.Oct 12 2020, 1:29 PM

It seems like a real race window, opened by my fine-grained locking years ago. The freeze is protected by devq->send_mtx, while the driver code is not protected by it, protected either by SIM lock, or possibly nothing at all. So for this specific driver your solution seems correct. For general case though it is more difficult.

This revision is now accepted and ready to land.Oct 12 2020, 2:13 PM

There's many races here around frozen queues, and I'll wager it's best to check the race is lost in the sim like this rather than introduce a new lock that would contend.

Though having said that. Scott is making the case that the whole recovery model needs a good overhaul give the diversity of practice in existing SIMs.