NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Hot-swapping disks



hf%spg.tu-darmstadt.de@localhost (Hauke Fath) writes:

>what is the state with NetBSD and hot-swapping disk drives?


>[ 1110.6034409] assert_sleepable() at netbsd:assert_sleepable+0x9c
>[ 1110.6367222] pool_cache_get_paddr() at=20
>netbsd:pool_cache_get_paddr+0x176
>[ 1110.6832707] kmem_intr_alloc() at netbsd:kmem_intr_alloc+0x70
>[ 1110.7143071] kern_malloc() at netbsd:kern_malloc+0x4d
>[ 1110.7460265] mpii_event_sas() at netbsd:mpii_event_sas+0x91
>[ 1110.7841959] mpii_intr() at netbsd:mpii_intr+0x20d


That's a bug in mpii(4).

mpii_event_sas() is called from interrupt context and in case
of a MPII_EVENT_SAS_TOPO_PS_RC_ADDED ("disk inserted") event may

        dev = malloc(sizeof(*dev), M_DEVBUF, M_WAITOK | M_ZERO);
        ... insert new dev into list ...

Obviously M_WAITOK is not allowed in an interrupt.


A MPII_EVENT_SAS_TOPO_PS_RC_MISSING ("disk removed") event is
deferred to a work queue to avoid such issues.

A simple fix is to not wait and ignore the event when malloc
fails. A better solution is probably to pre-allocate the
devices (currently an array of pointers is pre-allocated,
but the 16-byte sized device records are allocated/freed
on demand).



Home | Main Index | Thread Index | Old Index