Patch "gfs2: Flag a withdraw if init_threads() fails" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gfs2: Flag a withdraw if init_threads() fails

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gfs2-flag-a-withdraw-if-init_threads-fails.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f7e0de49b61d9508bf0c59f2feb7e80ce7dc9488
Author: Andrew Price <anprice@xxxxxxxxxx>
Date:   Mon Mar 15 12:24:00 2021 +0000

    gfs2: Flag a withdraw if init_threads() fails
    
    [ Upstream commit 62dd0f98a0e5668424270b47a0c2e973795faba7 ]
    
    Interrupting mount with ^C quickly enough can cause the kthread_run()
    calls in gfs2's init_threads() to fail and the error path leads to a
    deadlock on the s_umount rwsem. The abridged chain of events is:
    
      [mount path]
      get_tree_bdev()
        sget_fc()
          alloc_super()
            down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); [acquired]
        gfs2_fill_super()
          gfs2_make_fs_rw()
            init_threads()
              kthread_run()
                ( Interrupted )
          [Error path]
          gfs2_gl_hash_clear()
            flush_workqueue(glock_workqueue)
              wait_for_completion()
    
      [workqueue context]
      glock_work_func()
        run_queue()
          do_xmote()
            freeze_go_sync()
              freeze_super()
                down_write(&sb->s_umount) [deadlock]
    
    In freeze_go_sync() there is a gfs2_withdrawn() check that we can use to
    make sure freeze_super() is not called in the error path, so add a
    gfs2_withdraw_delayed() call when init_threads() fails.
    
    Ref: https://bugzilla.kernel.org/show_bug.cgi?id=212231
    
    Reported-by: Alexander Aring <aahringo@xxxxxxxxxx>
    Signed-off-by: Andrew Price <anprice@xxxxxxxxxx>
    Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 754ea2a137b4..34ca312457a6 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -169,8 +169,10 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
 	int error;
 
 	error = init_threads(sdp);
-	if (error)
+	if (error) {
+		gfs2_withdraw_delayed(sdp);
 		return error;
+	}
 
 	j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
 	if (gfs2_withdrawn(sdp)) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux