HomeFreeBSD

Fix da(4) locking when probing SMR drives.

Description

Fix da(4) locking when probing SMR drives.

Probing host aware and host managed SMR drives got broken in revision

The added cam_periph_lock() calls were in areas in dadone() where
the peripheral lock was already held.

Since then, dadone() has been split into separate functions that are
dedicated to each probe state.

The result is that when probing a host aware drive, I ran into a recursive
lock acquisition in dadone_probeatalogdir(). I would have run into the
same problem in dadone_probeataiddir(), and in dadone_probeatasup() and
dadone_probeatazone() in the error paths had the probe continued.

The solution is to take out all of the extra cam_periph_lock() calls. I
also added cam_periph_assert(periph, MA_OWNED) near the top of each of
the dadone_* calls. These make it clear to anyone coming along in the
the future that the lock is held in the probe done functions.

Also add a locking assert in daprobedone(), to make it clear that it must
be called with the periph lock held.

Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D15764

Details

Provenance
kenAuthored on
Differential Revision
D15764: Fix da(4) probe locking problems.
Parents
rS335153: MFC r333130: Improve nvme(4) attach/detach sequences.
Branches
Unknown
Tags
Unknown