Skip to content

Commit f3054e5

Browse files
LiBaokun96tytso
authored andcommitted
ext4: add EXT4_FLAGS_EMERGENCY_RO bit
EXT4_FLAGS_EMERGENCY_RO Indicates that the current file system has become read-only due to some error. Compared to SB_RDONLY, setting it does not require a lock because we won't clear it, which avoids over-coupling with vfs freeze. Also, add a helper function ext4_emergency_ro() to check if the bit is set. Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 99708f8 commit f3054e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/ext4/ext4.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,13 +2239,19 @@ enum {
22392239
EXT4_FLAGS_RESIZING, /* Avoid superblock update and resize race */
22402240
EXT4_FLAGS_SHUTDOWN, /* Prevent access to the file system */
22412241
EXT4_FLAGS_BDEV_IS_DAX, /* Current block device support DAX */
2242+
EXT4_FLAGS_EMERGENCY_RO,/* Emergency read-only due to fs errors */
22422243
};
22432244

22442245
static inline int ext4_forced_shutdown(struct super_block *sb)
22452246
{
22462247
return test_bit(EXT4_FLAGS_SHUTDOWN, &EXT4_SB(sb)->s_ext4_flags);
22472248
}
22482249

2250+
static inline int ext4_emergency_ro(struct super_block *sb)
2251+
{
2252+
return test_bit(EXT4_FLAGS_EMERGENCY_RO, &EXT4_SB(sb)->s_ext4_flags);
2253+
}
2254+
22492255
/*
22502256
* Default values for user and/or group using reserved blocks
22512257
*/

0 commit comments

Comments
 (0)