• Mike Snitzer's avatar
    dm thin: switch to read-only mode if metadata space is exhausted · 4a02b34e
    Mike Snitzer authored
    Switch the thin pool to read-only mode in alloc_data_block() if
    dm_pool_alloc_data_block() fails because the pool's metadata space is
    exhausted.
    
    Differentiate between data and metadata space in messages about no
    free space available.
    
    This issue was noticed with the device-mapper-test-suite using:
    dmtest run --suite thin-provisioning -n /exhausting_metadata_space_causes_fail_mode/
    
    The quantity of errors logged in this case must be reduced.
    
    before patch:
    
    device-mapper: thin: 253:4: reached low water mark for metadata device: sending event.
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    <snip ... these repeat for a _very_ long while ... >
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: 253:4: commit failed: error = -28
    device-mapper: thin: 253:4: switching pool to read-only mode
    
    after patch:
    
    device-mapper: thin: 253:4: reached low water mark for metadata device: sending event.
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: 253:4: no free metadata space available.
    device-mapper: thin: 253:4: switching pool to read-only mode
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Acked-by: default avatarJoe Thornber <ejt@redhat.com>
    Cc: stable@vger.kernel.org
    4a02b34e
dm-thin.c 74.9 KB