• Kent Overstreet's avatar
    bcachefs: Fix race in bch2_write_super() · 54541c1f
    Kent Overstreet authored
    bch2_write_super() was looping over online devices multiple times -
    dropping and retaking io_ref each time.
    
    This meant it could race with device removal; it could increment the
    sequence number on a device but fail to write it - and then if the
    device was re-added, it would get confused the next time around thinking
    a superblock write was silently dropped.
    
    Fix this by taking io_ref once, and stashing pointers to online devices
    in a darray.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    54541c1f
super-io.c 36.6 KB