Page MenuHomeFreeBSD

Fix da(4) probe locking problems.
ClosedPublic

Authored by ken on Jun 11 2018, 7:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Aug 6 2023, 10:28 AM
Unknown Object (File)
Jun 21 2023, 1:27 PM
Unknown Object (File)
May 6 2023, 9:42 AM
Unknown Object (File)
Mar 3 2023, 4:36 PM
Unknown Object (File)
Mar 2 2023, 2:25 PM
Unknown Object (File)
Feb 14 2023, 9:44 AM
Unknown Object (File)
Feb 1 2023, 5:38 PM
Unknown Object (File)
Dec 16 2022, 1:54 PM
Subscribers
None

Details

Summary

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

  1. 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.

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.

Test Plan

Boot with a Host Aware or Host Managed SATA SMR drive.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

try 'camcontrol rescan all'. That's the usual case that breaks locking :(

In D15764#333114, @imp wrote:

try 'camcontrol rescan all'. That's the usual case that breaks locking :(

That does work fine on this particular machine, at least from a locking standpoint. I've got a couple of broken drives that throw errors, though. :)

No other comments after a few days...

This revision is now accepted and ready to land.Jun 14 2018, 5:04 PM
This revision was automatically updated to reflect the committed changes.