]> www.infradead.org Git - users/hch/misc.git/commit
ext4: add ext4_emergency_state() helper function
authorBaokun Li <libaokun1@huawei.com>
Wed, 22 Jan 2025 11:41:26 +0000 (19:41 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 13 Mar 2025 14:16:34 +0000 (10:16 -0400)
commit0a1b2f5ea98764221ccc1043b8dc27a8c0225476
tree715683e257162a67e33521799ab6b1222823b72e
parentf3054e53c2f367bd3cf6535afe9ab13198d2d739
ext4: add ext4_emergency_state() helper function

Since both SHUTDOWN and EMERGENCY_RO are emergency states of the ext4 file
system, and they are checked in similar locations, we have added a helper
function, ext4_emergency_state(), to determine whether the current file
system is in one of these two emergency states.

Then, replace calls to ext4_forced_shutdown() with ext4_emergency_state()
in those functions that could potentially trigger write operations.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20250122114130.229709-4-libaokun@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 files changed:
fs/ext4/ext4.h
fs/ext4/ext4_jbd2.c
fs/ext4/file.c
fs/ext4/fsync.c
fs/ext4/ialloc.c
fs/ext4/inline.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/mmp.c
fs/ext4/namei.c
fs/ext4/page-io.c
fs/ext4/super.c