• Andreas Gruenbacher's avatar
    gfs2: Fix freeze consistency check in log_write_header · e345b87b
    Andreas Gruenbacher authored
    Functions gfs2_freeze_super() and gfs2_thaw_super() are using the
    SDF_FROZEN flag to indicate when the filesystem is frozen, synchronized
    by sd_freeze_mutex.  However, this doesn't prevent writes from happening
    between the point of calling thaw_super() and the point where the
    SDF_FROZEN flag is cleared, so the following assert can trigger in
    log_write_header():
    
        gfs2_assert_withdraw(sdp, !test_bit(SDF_FROZEN, &sdp->sd_flags));
    
    Fix that by checking for sb->s_writers.frozen != SB_FREEZE_COMPLETE in
    log_write_header() instead.  To make sure that the filesystem-specific
    part of freezing happens before sb->s_writers.frozen is set to
    SB_FREEZE_COMPLETE, move that code from gfs2_freeze_locally() into
    gfs2_freeze_fs() and hook that up to the .freeze_fs operation.
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    e345b87b
log.c 37.1 KB