]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
g_vfs_done: Report when we switch on ENXIO conversion
authorWarner Losh <imp@FreeBSD.org>
Sun, 24 Apr 2022 19:54:20 +0000 (13:54 -0600)
committerWarner Losh <imp@FreeBSD.org>
Sun, 24 Apr 2022 20:01:08 +0000 (14:01 -0600)
commite8827f4094cb9ec7c5a4dcf9ee144442c989cd0c
tree5a8f3c769c8c89a0b78a9d71b88f1cf66c4f4c84
parentf58385f3daf61df8810e84acdcc13aa43d6f8e27
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
sys/geom/geom_vfs.c