• NeilBrown's avatar
    md: fix possible corruption of array metadata on shutdown. · 30b8aa91
    NeilBrown authored
    commit c744a65c
      md: don't set md arrays to readonly on shutdown.
    
    removed the possibility of a 'BUG' when data is written to an array
    that has just been switched to read-only, but also introduced the
    possibility that the array metadata could be corrupted.
    
    If, when md_notify_reboot gets the mddev lock, the array is
    in a state where it is assembled but hasn't been started (as can
    happen if the personality module is not available, or in other unusual
    situations), then incorrect metadata will be written out making it
    impossible to re-assemble the array.
    
    So only call __md_stop_writes() if the array has actually been
    activated.
    
    This patch is needed for any stable kernel which has had the above
    commit applied.
    
    Cc: stable@vger.kernel.org
    Reported-by: default avatarChristoph Nelles <evilazrael@evilazrael.de>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    30b8aa91
md.c 214 KB