• Mike Snitzer's avatar
    dm thin: ensure user takes action to validate data and metadata consistency · 07f2b6e0
    Mike Snitzer authored
    If a thin metadata operation fails the current transaction will abort,
    whereby causing potential for IO layers up the stack (e.g. filesystems)
    to have data loss.  As such, set THIN_METADATA_NEEDS_CHECK_FLAG in the
    thin metadata's superblock which:
    1) requires the user verify the thin metadata is consistent (e.g. use
       thin_check, etc)
    2) suggests the user verify the thin data is consistent (e.g. use fsck)
    
    The only way to clear the superblock's THIN_METADATA_NEEDS_CHECK_FLAG is
    to run thin_repair.
    
    On metadata operation failure: abort current metadata transaction, set
    pool in read-only mode, and now set the needs_check flag.
    
    As part of this change, constraints are introduced or relaxed:
    * don't allow a pool to transition to write mode if needs_check is set
    * don't allow data or metadata space to be resized if needs_check is set
    * if a thin pool's metadata space is exhausted: the kernel will now
      force the user to take the pool offline for repair before the kernel
      will allow the metadata space to be extended.
    
    Also, update Documentation to include information about when the thin
    provisioning target commits metadata, how it handles metadata failures
    and running out of space.
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
    07f2b6e0
dm-thin-metadata.h 6.17 KB