• Bob Peterson's avatar
    gfs2: move freeze glock outside the make_fs_rw and _ro functions · 96b1454f
    Bob Peterson authored
    Before this patch, sister functions gfs2_make_fs_rw and gfs2_make_fs_ro locked
    (held) the freeze glock by calling gfs2_freeze_lock and gfs2_freeze_unlock.
    The problem is, not all the callers of gfs2_make_fs_ro should be doing this.
    The three callers of gfs2_make_fs_ro are: remount (gfs2_reconfigure),
    signal_our_withdraw, and unmount (gfs2_put_super). But when unmounting the
    file system we can get into the following circular lock dependency:
    
    deactivate_super
       down_write(&s->s_umount); <-------------------------------------- s_umount
       deactivate_locked_super
          gfs2_kill_sb
             kill_block_super
                generic_shutdown_super
                   gfs2_put_super
                      gfs2_make_fs_ro
                         gfs2_glock_nq_init sd_freeze_gl
                            freeze_go_sync
                               if (freeze glock in SH)
                                  freeze_super (vfs)
                                     down_write(&sb->s_umount); <------- s_umount
    
    This patch moves the hold of the freeze glock outside the two sister rw/ro
    functions to their callers, but it doesn't request the glock from
    gfs2_put_super, thus eliminating the circular dependency.
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    96b1454f
util.c 15.5 KB