• Joe Thornber's avatar
    dm thin: switch to read only mode if a mapping insert fails · fafc7a81
    Joe Thornber authored
    Switch the thin pool to read-only mode when dm_thin_insert_block() fails
    since there is little reason to expect the cause of the failure to be
    resolved without further action by user space.
    
    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: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: dm_thin_insert_block() failed
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map metadata: unable to allocate new metadata block
    <snip ... these repeat for a long while ... >
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: space map common: dm_tm_shadow_block() failed
    device-mapper: thin: 253:4: no free metadata space available.
    device-mapper: thin: 253:4: switching pool to read-only mode
    
    after patch:
    
    device-mapper: space map metadata: unable to allocate new metadata block
    device-mapper: thin: 253:4: dm_thin_insert_block() failed: error = -28
    device-mapper: thin: 253:4: switching pool to read-only mode
    Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Cc: stable@vger.kernel.org
    fafc7a81
dm-thin.c 74.7 KB