Patch "f2fs: fix iostat lock protection" has been added to the 6.2-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: fix iostat lock protection

to the 6.2-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-fix-iostat-lock-protection.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 8d8b4fd1e3902a3d47ddac0067a4a7c83c80bc20
Author: Qilin Tan <qilin.tan@xxxxxxxxxxxx>
Date:   Fri Mar 31 17:26:56 2023 +0800

    f2fs: fix iostat lock protection
    
    [ Upstream commit 144f1cd40bf91fb3ac1d41806470756ce774f389 ]
    
    Made iostat lock irq safe to avoid potentinal deadlock.
    
    Deadlock scenario:
    f2fs_attr_store
      -> f2fs_sbi_store
      -> _sbi_store
      -> spin_lock(sbi->iostat_lock)
        <interrupt request>
        -> scsi_end_request
        -> bio_endio
        -> f2fs_dio_read_end_io
        -> f2fs_update_iostat
        -> spin_lock_irqsave(sbi->iostat_lock)  ===> Dead lock here
    
    Fixes: 61803e984307 ("f2fs: fix iostat related lock protection")
    Fixes: a1e09b03e6f5 ("f2fs: use iomap for direct I/O")
    Signed-off-by: Qilin Tan <qilin.tan@xxxxxxxxxxxx>
    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/sysfs.c b/fs/f2fs/sysfs.c
index 088b816127ecb..2884efe5269ed 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -564,9 +564,9 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 	if (!strcmp(a->attr.name, "iostat_period_ms")) {
 		if (t < MIN_IOSTAT_PERIOD_MS || t > MAX_IOSTAT_PERIOD_MS)
 			return -EINVAL;
-		spin_lock(&sbi->iostat_lock);
+		spin_lock_irq(&sbi->iostat_lock);
 		sbi->iostat_period_ms = (unsigned int)t;
-		spin_unlock(&sbi->iostat_lock);
+		spin_unlock_irq(&sbi->iostat_lock);
 		return count;
 	}
 #endif



[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