• Bob Peterson's avatar
    gfs2: dequeue iopen holder in gfs2_inode_lookup error · 763766c0
    Bob Peterson authored
    Before this patch, if function gfs2_inode_lookup encountered an error
    after it had locked the iopen glock, it never unlocked it, relying on
    the evict code to do the cleanup.  The evict code then took the
    inode glock while holding the iopen glock, which violates the locking
    order.  For example,
    
     (1) node A does a gfs2_inode_lookup that fails, leaving the iopen glock
         locked.
    
     (2) node B calls delete_work_func -> gfs2_lookup_by_inum ->
         gfs2_inode_lookup.  It locks the inode glock and blocks trying to
         lock the iopen glock, which is held by node A.
    
     (3) node A eventually calls gfs2_evict_inode -> evict_should_delete.
         It blocks trying to lock the inode glock, which is now held by
         node B.
    
    This patch introduces error handling to function gfs2_inode_lookup
    so it properly dequeues held iopen glocks on errors.
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    763766c0
inode.c 51.8 KB