• B
    gfs2: fix a deadlock on withdraw-during-mount · 865cc3e9
    Bob Peterson 提交于
    Before this patch, gfs2 would deadlock because of the following
    sequence during mount:
    
    mount
       gfs2_fill_super
          gfs2_make_fs_rw <--- Detects IO error with glock
             kthread_stop(sdp->sd_quotad_process);
                <--- Blocked waiting for quotad to finish
    
    logd
       Detects IO error and the need to withdraw
       calls gfs2_withdraw
          gfs2_make_fs_ro
             kthread_stop(sdp->sd_quotad_process);
                <--- Blocked waiting for quotad to finish
    
    gfs2_quotad
       gfs2_statfs_sync
          gfs2_glock_wait <---- Blocked waiting for statfs glock to be granted
    
    glock_work_func
       do_xmote <---Detects IO error, can't release glock: blocked on withdraw
          glops->go_inval
          glock_blocked_by_withdraw
             requeue glock work & exit <--- work requeued, blocked by withdraw
    
    This patch makes a special exception for the statfs system inode glock,
    which allows the statfs glock UNLOCK to proceed normally. That allows the
    quotad daemon to exit during the withdraw, which allows the logd daemon
    to exit during the withdraw, which allows the mount to exit.
    Signed-off-by: NBob Peterson <rpeterso@redhat.com>
    Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
    865cc3e9
glock.c 65.4 KB