gmirror: Fix a bug introduced in r341674
r341674 inadvertently introduced a bug where newer mirror components being tasted would clear the high sc_flags that are not controlled by component metadata, such as G_MIRROR_DEVICE_FLAG_TASTING. This could plausibly expose a small window of time during STARTING where device destruction might race with mirror component addition, probably resulting in a crash. Reviewed by: markj X-MFC-With: r341674 Differential Revision: https://reviews.freebsd.org/D18521
This commit is contained in:
parent
672225254d
commit
25cda747b0
@ -3061,6 +3061,8 @@ g_mirror_reinit_from_metadata(struct g_mirror_softc *sc,
|
||||
const struct g_mirror_metadata *md)
|
||||
{
|
||||
|
||||
sx_assert(&sc->sc_lock, SX_XLOCKED);
|
||||
|
||||
sc->sc_genid = md->md_genid;
|
||||
sc->sc_syncid = md->md_syncid;
|
||||
|
||||
@ -3068,7 +3070,8 @@ g_mirror_reinit_from_metadata(struct g_mirror_softc *sc,
|
||||
sc->sc_balance = md->md_balance;
|
||||
sc->sc_mediasize = md->md_mediasize;
|
||||
sc->sc_ndisks = md->md_all;
|
||||
sc->sc_flags = md->md_mflags;
|
||||
sc->sc_flags &= ~G_MIRROR_DEVICE_FLAG_MASK;
|
||||
sc->sc_flags |= (md->md_mflags & G_MIRROR_DEVICE_FLAG_MASK);
|
||||
}
|
||||
|
||||
struct g_geom *
|
||||
|
Loading…
Reference in New Issue
Block a user