All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [dm:for-next 20/20] drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here
@ 2021-06-02 21:25 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-06-02 21:25 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: kbuild-all, Mike Snitzer, Himanshu Madhani, clang-built-linux, dm-devel

[-- Attachment #1: Type: text/plain, Size: 4157 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head:   2c243153d1d4be4e23735cd10984ac17c7a54531
commit: 2c243153d1d4be4e23735cd10984ac17c7a54531 [20/20] dm: Forbid requeue of writes to zones
config: riscv-randconfig-r011-20210602 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?id=2c243153d1d4be4e23735cd10984ac17c7a54531
        git remote add dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
        git fetch --no-tags dm for-next
        git checkout 2c243153d1d4be4e23735cd10984ac17c7a54531
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here [-Wuninitialized]
                               !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
                                                                  ^~~
   include/asm-generic/bug.h:102:25: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_on = !!(condition);                      \
                                  ^~~~~~~~~
   drivers/md/dm.c:832:17: note: initialize the variable 'bio' to silence this warning
           struct bio *bio;
                          ^
                           = NULL
   1 warning generated.


vim +/bio +850 drivers/md/dm.c

   823	
   824	/*
   825	 * Decrements the number of outstanding ios that a bio has been
   826	 * cloned into, completing the original io if necc.
   827	 */
   828	static void dec_pending(struct dm_io *io, blk_status_t error)
   829	{
   830		unsigned long flags;
   831		blk_status_t io_error;
   832		struct bio *bio;
   833		struct mapped_device *md = io->md;
   834	
   835		/* Push-back supersedes any I/O errors */
   836		if (unlikely(error)) {
   837			spin_lock_irqsave(&io->endio_lock, flags);
   838			if (!(io->status == BLK_STS_DM_REQUEUE && __noflush_suspending(md)))
   839				io->status = error;
   840			spin_unlock_irqrestore(&io->endio_lock, flags);
   841		}
   842	
   843		if (atomic_dec_and_test(&io->io_count)) {
   844			if (io->status == BLK_STS_DM_REQUEUE) {
   845				/*
   846				 * Target requested pushing back the I/O.
   847				 */
   848				spin_lock_irqsave(&md->deferred_lock, flags);
   849				if (__noflush_suspending(md) &&
 > 850				    !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
   851					/* NOTE early return due to BLK_STS_DM_REQUEUE below */
   852					bio_list_add_head(&md->deferred, io->orig_bio);
   853				else
   854					/*
   855					 * noflush suspend was interrupted or this is
   856					 * a write to a zoned target.
   857					 */
   858					io->status = BLK_STS_IOERR;
   859				spin_unlock_irqrestore(&md->deferred_lock, flags);
   860			}
   861	
   862			io_error = io->status;
   863			bio = io->orig_bio;
   864			end_io_acct(io);
   865			free_io(md, io);
   866	
   867			if (io_error == BLK_STS_DM_REQUEUE)
   868				return;
   869	
   870			if ((bio->bi_opf & REQ_PREFLUSH) && bio->bi_iter.bi_size) {
   871				/*
   872				 * Preflush done for flush with data, reissue
   873				 * without REQ_PREFLUSH.
   874				 */
   875				bio->bi_opf &= ~REQ_PREFLUSH;
   876				queue_io(md, bio);
   877			} else {
   878				/* done with normal IO or empty flush */
   879				if (io_error)
   880					bio->bi_status = io_error;
   881				bio_endio(bio);
   882			}
   883		}
   884	}
   885	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20714 bytes --]

[-- Attachment #3: Type: text/plain, Size: 97 bytes --]

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dm:for-next 20/20] drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here
@ 2021-06-02 21:25 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-06-02 21:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4263 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head:   2c243153d1d4be4e23735cd10984ac17c7a54531
commit: 2c243153d1d4be4e23735cd10984ac17c7a54531 [20/20] dm: Forbid requeue of writes to zones
config: riscv-randconfig-r011-20210602 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?id=2c243153d1d4be4e23735cd10984ac17c7a54531
        git remote add dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
        git fetch --no-tags dm for-next
        git checkout 2c243153d1d4be4e23735cd10984ac17c7a54531
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here [-Wuninitialized]
                               !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
                                                                  ^~~
   include/asm-generic/bug.h:102:25: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_on = !!(condition);                      \
                                  ^~~~~~~~~
   drivers/md/dm.c:832:17: note: initialize the variable 'bio' to silence this warning
           struct bio *bio;
                          ^
                           = NULL
   1 warning generated.


vim +/bio +850 drivers/md/dm.c

   823	
   824	/*
   825	 * Decrements the number of outstanding ios that a bio has been
   826	 * cloned into, completing the original io if necc.
   827	 */
   828	static void dec_pending(struct dm_io *io, blk_status_t error)
   829	{
   830		unsigned long flags;
   831		blk_status_t io_error;
   832		struct bio *bio;
   833		struct mapped_device *md = io->md;
   834	
   835		/* Push-back supersedes any I/O errors */
   836		if (unlikely(error)) {
   837			spin_lock_irqsave(&io->endio_lock, flags);
   838			if (!(io->status == BLK_STS_DM_REQUEUE && __noflush_suspending(md)))
   839				io->status = error;
   840			spin_unlock_irqrestore(&io->endio_lock, flags);
   841		}
   842	
   843		if (atomic_dec_and_test(&io->io_count)) {
   844			if (io->status == BLK_STS_DM_REQUEUE) {
   845				/*
   846				 * Target requested pushing back the I/O.
   847				 */
   848				spin_lock_irqsave(&md->deferred_lock, flags);
   849				if (__noflush_suspending(md) &&
 > 850				    !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
   851					/* NOTE early return due to BLK_STS_DM_REQUEUE below */
   852					bio_list_add_head(&md->deferred, io->orig_bio);
   853				else
   854					/*
   855					 * noflush suspend was interrupted or this is
   856					 * a write to a zoned target.
   857					 */
   858					io->status = BLK_STS_IOERR;
   859				spin_unlock_irqrestore(&md->deferred_lock, flags);
   860			}
   861	
   862			io_error = io->status;
   863			bio = io->orig_bio;
   864			end_io_acct(io);
   865			free_io(md, io);
   866	
   867			if (io_error == BLK_STS_DM_REQUEUE)
   868				return;
   869	
   870			if ((bio->bi_opf & REQ_PREFLUSH) && bio->bi_iter.bi_size) {
   871				/*
   872				 * Preflush done for flush with data, reissue
   873				 * without REQ_PREFLUSH.
   874				 */
   875				bio->bi_opf &= ~REQ_PREFLUSH;
   876				queue_io(md, bio);
   877			} else {
   878				/* done with normal IO or empty flush */
   879				if (io_error)
   880					bio->bi_status = io_error;
   881				bio_endio(bio);
   882			}
   883		}
   884	}
   885	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 20714 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-devel] [dm:for-next 20/20] drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here
  2021-06-02 21:25 ` kernel test robot
  (?)
@ 2021-06-03  0:02 ` Damien Le Moal
  -1 siblings, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2021-06-03  0:02 UTC (permalink / raw)
  To: Mike Snitzer, dm-devel; +Cc: Himanshu Madhani

On 2021/06/03 6:26, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
> head:   2c243153d1d4be4e23735cd10984ac17c7a54531
> commit: 2c243153d1d4be4e23735cd10984ac17c7a54531 [20/20] dm: Forbid requeue of writes to zones
> config: riscv-randconfig-r011-20210602 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install riscv cross compiling tool for clang build
>         # apt-get install binutils-riscv64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?id=2c243153d1d4be4e23735cd10984ac17c7a54531
>         git remote add dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
>         git fetch --no-tags dm for-next
>         git checkout 2c243153d1d4be4e23735cd10984ac17c7a54531
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here [-Wuninitialized]
>                                !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
>                                                                   ^~~
>    include/asm-generic/bug.h:102:25: note: expanded from macro 'WARN_ON_ONCE'
>            int __ret_warn_on = !!(condition);                      \
>                                   ^~~~~~~~~
>    drivers/md/dm.c:832:17: note: initialize the variable 'bio' to silence this warning
>            struct bio *bio;
>                           ^
>                            = NULL
>    1 warning generated.
> 
> 
> vim +/bio +850 drivers/md/dm.c
> 
>    823	
>    824	/*
>    825	 * Decrements the number of outstanding ios that a bio has been
>    826	 * cloned into, completing the original io if necc.
>    827	 */
>    828	static void dec_pending(struct dm_io *io, blk_status_t error)
>    829	{
>    830		unsigned long flags;
>    831		blk_status_t io_error;
>    832		struct bio *bio;
>    833		struct mapped_device *md = io->md;
>    834	
>    835		/* Push-back supersedes any I/O errors */
>    836		if (unlikely(error)) {
>    837			spin_lock_irqsave(&io->endio_lock, flags);
>    838			if (!(io->status == BLK_STS_DM_REQUEUE && __noflush_suspending(md)))
>    839				io->status = error;
>    840			spin_unlock_irqrestore(&io->endio_lock, flags);
>    841		}
>    842	
>    843		if (atomic_dec_and_test(&io->io_count)) {
>    844			if (io->status == BLK_STS_DM_REQUEUE) {
>    845				/*
>    846				 * Target requested pushing back the I/O.
>    847				 */
>    848				spin_lock_irqsave(&md->deferred_lock, flags);
>    849				if (__noflush_suspending(md) &&
>  > 850				    !WARN_ON_ONCE(dm_is_zone_write(md, bio)))

Mike,

This needs to be WARN_ON_ONCE(dm_is_zone_write(md, io->orig_bio)).
Or better, we can move line 863 below right after the
"if (atomic_dec_and_test(&io->io_count)) {" above.

Do you want me to resend ? Or can you fix it up ?

Thanks !


>    851					/* NOTE early return due to BLK_STS_DM_REQUEUE below */
>    852					bio_list_add_head(&md->deferred, io->orig_bio);
>    853				else
>    854					/*
>    855					 * noflush suspend was interrupted or this is
>    856					 * a write to a zoned target.
>    857					 */
>    858					io->status = BLK_STS_IOERR;
>    859				spin_unlock_irqrestore(&md->deferred_lock, flags);
>    860			}
>    861	
>    862			io_error = io->status;
>    863			bio = io->orig_bio;
>    864			end_io_acct(io);
>    865			free_io(md, io);
>    866	
>    867			if (io_error == BLK_STS_DM_REQUEUE)
>    868				return;
>    869	
>    870			if ((bio->bi_opf & REQ_PREFLUSH) && bio->bi_iter.bi_size) {
>    871				/*
>    872				 * Preflush done for flush with data, reissue
>    873				 * without REQ_PREFLUSH.
>    874				 */
>    875				bio->bi_opf &= ~REQ_PREFLUSH;
>    876				queue_io(md, bio);
>    877			} else {
>    878				/* done with normal IO or empty flush */
>    879				if (io_error)
>    880					bio->bi_status = io_error;
>    881				bio_endio(bio);
>    882			}
>    883		}
>    884	}
>    885	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 


-- 
Damien Le Moal
Western Digital Research



--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-03  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 21:25 [dm-devel] [dm:for-next 20/20] drivers/md/dm.c:850:43: warning: variable 'bio' is uninitialized when used here kernel test robot
2021-06-02 21:25 ` kernel test robot
2021-06-03  0:02 ` [dm-devel] " Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.