Re: [PATCH v2] f2fs: fix zoned block device information initialization

From: Dan Carpenter
Date: Mon Jan 22 2024 - 01:44:52 EST


Hi Wenjie,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Wenjie-Qi/f2fs-fix-zoned-block-device-information-initialization/20240116-220824
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link: https://lore.kernel.org/r/20240116140513.1222-1-qwjhust%40gmail.com
patch subject: [PATCH v2] f2fs: fix zoned block device information initialization
config: x86_64-randconfig-161-20240119 (https://download.01.org/0day-ci/archive/20240120/202401201237.ovVyEKvs-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202401201237.ovVyEKvs-lkp@xxxxxxxxx/

New smatch warnings:
fs/f2fs/super.c:2393 f2fs_remount() warn: missing error code 'err'

Old smatch warnings:
fs/f2fs/super.c:4040 read_raw_super_block() warn: possible memory leak of 'super'

vim +/err +2393 fs/f2fs/super.c

4b2414d04e9912 Chao Yu 2017-08-08 2371
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2372 /* recover superblocks we couldn't write due to previous RO mount */
1751e8a6cb935e Linus Torvalds 2017-11-27 2373 if (!(*flags & SB_RDONLY) && is_sbi_flag_set(sbi, SBI_NEED_SB_WRITE)) {
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2374 err = f2fs_commit_super(sbi, false);
dcbb4c10e6d969 Joe Perches 2019-06-18 2375 f2fs_info(sbi, "Try to recover all the superblocks, ret: %d",
dcbb4c10e6d969 Joe Perches 2019-06-18 2376 err);
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2377 if (!err)
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2378 clear_sbi_flag(sbi, SBI_NEED_SB_WRITE);
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2379 }
df728b0f6954c3 Jaegeuk Kim 2016-03-23 2380
458c15dfbce62c Chao Yu 2023-05-23 2381 default_options(sbi, true);
26666c8a4366de Chao Yu 2014-09-15 2382
696c018c7718f5 Namjae Jeon 2013-06-16 2383 /* parse mount options */
ed318a6cc0b620 Eric Biggers 2020-05-12 2384 err = parse_options(sb, data, true);
696c018c7718f5 Namjae Jeon 2013-06-16 2385 if (err)
696c018c7718f5 Namjae Jeon 2013-06-16 2386 goto restore_opts;
696c018c7718f5 Namjae Jeon 2013-06-16 2387
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2388 #ifdef CONFIG_BLK_DEV_ZONED
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2389 if (sbi->max_active_zones && sbi->max_active_zones < F2FS_OPTION(sbi).active_logs) {
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2390 f2fs_err(sbi,
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2391 "zoned: max active zones %u is too small, need at least %u active zones",
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2392 sbi->max_active_zones, F2FS_OPTION(sbi).active_logs);
ed7a1efe8afd55 Wenjie Qi 2024-01-16 @2393 goto restore_opts;

err = -EINVAL?

ed7a1efe8afd55 Wenjie Qi 2024-01-16 2394 }
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2395 #endif
ed7a1efe8afd55 Wenjie Qi 2024-01-16 2396
b62e71be2110d8 Chao Yu 2023-04-23 2397 /* flush outstanding errors before changing fs state */
b62e71be2110d8 Chao Yu 2023-04-23 2398 flush_work(&sbi->s_error_work);
b62e71be2110d8 Chao Yu 2023-04-23 2399
696c018c7718f5 Namjae Jeon 2013-06-16 2400 /*
696c018c7718f5 Namjae Jeon 2013-06-16 2401 * Previous and new state of filesystem is RO,
876dc59eb1f013 Gu Zheng 2014-04-11 2402 * so skip checking GC and FLUSH_MERGE conditions.
696c018c7718f5 Namjae Jeon 2013-06-16 2403 */
1751e8a6cb935e Linus Torvalds 2017-11-27 2404 if (f2fs_readonly(sb) && (*flags & SB_RDONLY))
696c018c7718f5 Namjae Jeon 2013-06-16 2405 goto skip;
696c018c7718f5 Namjae Jeon 2013-06-16 2406
d78dfefcde9d31 Chao Yu 2023-04-04 2407 if (f2fs_dev_is_readonly(sbi) && !(*flags & SB_RDONLY)) {
a7d9fe3c338870 Jaegeuk Kim 2021-05-21 2408 err = -EROFS;
a7d9fe3c338870 Jaegeuk Kim 2021-05-21 2409 goto restore_opts;
a7d9fe3c338870 Jaegeuk Kim 2021-05-21 2410 }
a7d9fe3c338870 Jaegeuk Kim 2021-05-21 2411

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki