Patch "f2fs: don't set RO when shutting down f2fs" has been added to the 6.6-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

    f2fs: don't set RO when shutting down f2fs

to the 6.6-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:
     f2fs-don-t-set-ro-when-shutting-down-f2fs.patch
and it can be found in the queue-6.6 subdirectory.

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



commit f1a3400ed331c3cd61b2c7a3e4af929321b54dc5
Author: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
Date:   Wed Apr 3 23:07:53 2024 +0000

    f2fs: don't set RO when shutting down f2fs
    
    [ Upstream commit 3bdb7f161697e2d5123b89fe1778ef17a44858e7 ]
    
    Shutdown does not check the error of thaw_super due to readonly, which
    causes a deadlock like below.
    
    f2fs_ioc_shutdown(F2FS_GOING_DOWN_FULLSYNC)        issue_discard_thread
     - bdev_freeze
      - freeze_super
     - f2fs_stop_checkpoint()
      - f2fs_handle_critical_error                     - sb_start_write
        - set RO                                         - waiting
     - bdev_thaw
      - thaw_super_locked
        - return -EINVAL, if sb_rdonly()
     - f2fs_stop_discard_thread
      -> wait for kthread_stop(discard_thread);
    
    Reported-by: "Light Hsieh (謝明燈)" <Light.Hsieh@xxxxxxxxxxxx>
    Reviewed-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 43424ca4f26c5..ce50d2253dd80 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4107,9 +4107,15 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,
 	if (shutdown)
 		set_sbi_flag(sbi, SBI_IS_SHUTDOWN);
 
-	/* continue filesystem operators if errors=continue */
-	if (continue_fs || f2fs_readonly(sb))
+	/*
+	 * Continue filesystem operators if errors=continue. Should not set
+	 * RO by shutdown, since RO bypasses thaw_super which can hang the
+	 * system.
+	 */
+	if (continue_fs || f2fs_readonly(sb) || shutdown) {
+		f2fs_warn(sbi, "Stopped filesystem due to reason: %d", reason);
 		return;
+	}
 
 	f2fs_warn(sbi, "Remounting filesystem read-only");
 	/*




[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