Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [bcachefs:bcachefs-testing 226/227] fs/bcachefs/recovery_passes.c:332:6: warning: variable 'in_recovery' is used uninitialized whenever 'if' condition is true
@ 2025-05-17 11:59 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-17 11:59 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: llvm, oe-kbuild-all, Kent Overstreet

tree:   https://evilpiepirate.org/git/bcachefs.git bcachefs-testing
head:   18721b36f18669525c303bf447446e4e9b15e0cc
commit: 5a3a12453df5915843cabc5b95d71fceba433fc7 [226/227] bcachefs: Run recovery passes asynchronously
config: riscv-randconfig-002-20250517 (https://download.01.org/0day-ci/archive/20250517/202505171930.jZF5fGGX-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250517/202505171930.jZF5fGGX-lkp@intel.com/reproduce)

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505171930.jZF5fGGX-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/bcachefs/recovery_passes.c:332:6: warning: variable 'in_recovery' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     332 |         if (!__recovery_pass_needs_set(c, pass, flags)) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/bcachefs/recovery_passes.c:371:7: note: uninitialized use occurs here
     371 |         if (!in_recovery) {
         |              ^~~~~~~~~~~
   fs/bcachefs/recovery_passes.c:332:2: note: remove the 'if' if its condition is always false
     332 |         if (!__recovery_pass_needs_set(c, pass, flags)) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     333 |                 r->passes_ratelimiting &= ~BIT_ULL(pass);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     334 |                 goto run_async;
         |                 ~~~~~~~~~~~~~~~
     335 |         }
         |         ~
   fs/bcachefs/recovery_passes.c:337:2: note: variable 'in_recovery' is declared here
     337 |         bool in_recovery = test_bit(BCH_FS_in_recovery, &c->flags);
         |         ^
   1 warning generated.


vim +332 fs/bcachefs/recovery_passes.c

   309	
   310	/*
   311	 * For when we need to rewind recovery passes and run a pass we skipped:
   312	 */
   313	int __bch2_run_explicit_recovery_pass(struct bch_fs *c,
   314					      struct printbuf *out,
   315					      enum bch_recovery_pass pass,
   316					      enum bch_run_recovery_pass_flags flags)
   317	{
   318		struct bch_fs_recovery *r = &c->recovery;
   319		int ret = 0;
   320	
   321		lockdep_assert_held(&c->sb_lock);
   322	
   323		bch2_printbuf_make_room(out, 1024);
   324		out->atomic++;
   325	
   326		unsigned long lockflags;
   327		spin_lock_irqsave(&r->lock, lockflags);
   328	
   329		if (!recovery_pass_needs_set(c, pass, flags))
   330			goto out;
   331	
 > 332		if (!__recovery_pass_needs_set(c, pass, flags)) {
   333			r->passes_ratelimiting &= ~BIT_ULL(pass);
   334			goto run_async;
   335		}
   336	
   337		bool in_recovery = test_bit(BCH_FS_in_recovery, &c->flags);
   338		bool rewind = in_recovery && r->curr_pass > pass;
   339	
   340		if ((flags & RUN_RECOVERY_PASS_nopersistent) && in_recovery) {
   341			r->passes_to_run |= BIT_ULL(pass);
   342		} else {
   343			struct bch_sb_field_ext *ext = bch2_sb_field_get(c->disk_sb.sb, ext);
   344			__set_bit_le64(bch2_recovery_pass_to_stable(pass), ext->recovery_passes_required);
   345		}
   346	
   347		if (pass < BCH_RECOVERY_PASS_set_may_go_rw &&
   348		    (!in_recovery || r->curr_pass >= BCH_RECOVERY_PASS_set_may_go_rw)) {
   349			prt_printf(out, "need recovery pass %s (%u), but already rw\n",
   350				   bch2_recovery_passes[pass], pass);
   351			ret = -BCH_ERR_cannot_rewind_recovery;
   352			goto out;
   353		}
   354	
   355		prt_printf(out, "running recovery pass %s (%u), currently at %s (%u)%s\n",
   356			   bch2_recovery_passes[pass], pass,
   357			   bch2_recovery_passes[r->curr_pass], r->curr_pass,
   358			   rewind ? " - rewinding" : "");
   359	
   360		if (test_bit(BCH_FS_in_recovery, &c->flags))
   361			r->passes_to_run |= BIT_ULL(pass);
   362		else if (flags & RUN_RECOVERY_PASS_ratelimit)
   363			r->passes_ratelimiting |= BIT_ULL(pass);
   364	
   365		if (rewind) {
   366			r->next_pass = pass;
   367			r->passes_complete &= (1ULL << pass) >> 1;
   368			ret = -BCH_ERR_restart_recovery;
   369		}
   370	run_async:
   371		if (!in_recovery) {
   372			struct recovery_pass_fn *p = recovery_pass_fns + pass;
   373			if (p->when & PASS_ONLINE)
   374				bch2_run_async_recovery_passes(c);
   375		}
   376	out:
   377		spin_unlock_irqrestore(&r->lock, lockflags);
   378		--out->atomic;
   379		return ret;
   380	}
   381	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-17 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17 11:59 [bcachefs:bcachefs-testing 226/227] fs/bcachefs/recovery_passes.c:332:6: warning: variable 'in_recovery' is used uninitialized whenever 'if' condition is true kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox