]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: fix iostat lock protection
authorQilin Tan <qilin.tan@mediatek.com>
Fri, 31 Mar 2023 09:26:56 +0000 (17:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:20 +0000 (23:03 +0900)
commite53825dc2ee77ad82633ea6c441d2434a28e755b
treebba73cf224eaef59afd5294d170909f02787f0bf
parent5ec047b2c6c0e67d3ee368b23daaa26645cdc678
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: e93afda57fb1 ("f2fs: fix iostat related lock protection")
Fixes: c95d891ed733 ("f2fs: use iomap for direct I/O")
Signed-off-by: Qilin Tan <qilin.tan@mediatek.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/sysfs.c