]> www.infradead.org Git - users/hch/misc.git/commitdiff
f2fs: fix condition in __allow_reserved_blocks()
authorChao Yu <chao@kernel.org>
Thu, 31 Jul 2025 06:03:38 +0000 (14:03 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 11 Aug 2025 17:03:27 +0000 (17:03 +0000)
If reserve_root mount option is not assigned, __allow_reserved_blocks()
will return false, it's not correct, fix it.

Fixes: 7e65be49ed94 ("f2fs: add reserved blocks for root user")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h

index 64a4fda315c9d18b7b0e0a186176481f5824deca..6b66db642e0981d9b4e20fdd612fb22308e547a8 100644 (file)
@@ -2389,8 +2389,6 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi,
 {
        if (!inode)
                return true;
-       if (!test_opt(sbi, RESERVE_ROOT))
-               return false;
        if (IS_NOQUOTA(inode))
                return true;
        if (uid_eq(F2FS_OPTION(sbi).s_resuid, current_fsuid()))
@@ -2411,7 +2409,7 @@ static inline unsigned int get_available_block_count(struct f2fs_sb_info *sbi,
        avail_user_block_count = sbi->user_block_count -
                                        sbi->current_reserved_blocks;
 
-       if (!__allow_reserved_blocks(sbi, inode, cap))
+       if (test_opt(sbi, RESERVE_ROOT) && !__allow_reserved_blocks(sbi, inode, cap))
                avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks;
 
        if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) {