• Joe Thornber's avatar
    dm cache: the CLEAN_SHUTDOWN flag was not being set · 3201ac45
    Joe Thornber authored
    If the CLEAN_SHUTDOWN flag is not set when a cache is loaded then all cache
    blocks are marked as dirty and a full writeback occurs.
    
    __commit_transaction() is responsible for setting/clearing
    CLEAN_SHUTDOWN (based the flags_mutator that is passed in).
    
    Fix this issue, of the cache's on-disk flags being wrong, by making sure
    __commit_transaction() does not reset the flags after the mutator has
    altered the flags in preparation for them being serialized to disk.
    
    before:
    
    sb_flags = mutator(le32_to_cpu(disk_super->flags));
    disk_super->flags = cpu_to_le32(sb_flags);
    disk_super->flags = cpu_to_le32(cmd->flags);
    
    after:
    
    disk_super->flags = cpu_to_le32(cmd->flags);
    sb_flags = mutator(le32_to_cpu(disk_super->flags));
    disk_super->flags = cpu_to_le32(sb_flags);
    Reported-by: default avatarBogdan Vasiliev <bogdan.vasiliev@gmail.com>
    Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Cc: stable@vger.kernel.org
    3201ac45
dm-cache-metadata.c 34.5 KB