• Bob Peterson's avatar
    gfs2: init system threads before freeze lock · a28dc123
    Bob Peterson authored
    Patch 96b1454f ("gfs2: move freeze glock outside the make_fs_rw and _ro
    functions") changed the gfs2 mount sequence so that it holds the freeze
    lock before calling gfs2_make_fs_rw. Before this patch, gfs2_make_fs_rw
    called init_threads to initialize the quotad and logd threads. That is a
    problem if the system needs to withdraw due to IO errors early in the
    mount sequence, for example, while initializing the system statfs inode:
    
    1. An IO error causes the statfs glock to not sync properly after
       recovery, and leaves items on the ail list.
    2. The leftover items on the ail list causes its do_xmote call to fail,
       which makes it want to withdraw. But since the glock code cannot
       withdraw (because the withdraw sequence uses glocks) it relies upon
       the logd daemon to initiate the withdraw.
    3. The withdraw can never be performed by the logd daemon because all
       this takes place before the logd daemon is started.
    
    This patch moves function init_threads from super.c to ops_fstype.c
    and it changes gfs2_fill_super to start its threads before holding the
    freeze lock, and if there's an error, stop its threads after releasing
    it. This allows the logd to run unblocked by the freeze lock. Thus,
    the logd daemon can perform its withdraw sequence properly.
    
    Fixes: 96b1454f
    
     ("gfs2: move freeze glock outside the make_fs_rw and _ro functions")
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    a28dc123
super.c 37.6 KB