HomeFreeBSD

g_vfs_done: Report when we switch on ENXIO conversion

Description

g_vfs_done: Report when we switch on ENXIO conversion

On the 0 -> 1 transition of sc_enxio_active, report that we're doing
this. This is a rare, but interesting, event. Convert to using atomics
to set this field to prevent a rare race:

In CAM, when we invalidate a device, one thread (T1) will start the
process in error processing called from *dadone
(cam_periph_error). This routine will queue work to xpt_async_td
(T2) and indicate to *dadone to call biodone(ENXIO) for the bio. T2
wakes up and basically waits to acquire the periph lock. T2 will do
so when T1 drops the periph lock just before T1's call to
biodone. T2 acquires the lock and calls biodone(ENXIO) on all
pending bios. These two threads will race and we could lose the
printf or get two in rare cases. Since we only touch sc_enxio_active
in an error path that's infrequent, the extra atomic traffic will be
rare but will ensure robustness.

Sponsored by: Netflix
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35037

Details

Provenance
impAuthored on Apr 24 2022, 7:54 PM
Reviewer
kib
Differential Revision
D35037: g_vfs_done: Report when we switch on ENXIO conversion
Parents
rGf58385f3daf6: geom_vfs: make sc_orphaned a bool
Branches
Unknown
Tags
Unknown