drivers/md/raid10.c:995 wait_barrier() warn: if();
From: kernel test robot
Date: Fri Apr 30 2021 - 10:17:51 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ca5297e7e38f2dc8c753d33a5092e7be181fff0
commit: fe630de009d0729584d79c78f43121e07c745fdc md/raid10: avoid deadlock on recovery.
date: 9 months ago
config: nds32-randconfig-m031-20210430 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
New smatch warnings:
drivers/md/raid10.c:995 wait_barrier() warn: if();
drivers/md/raid10.c:995 wait_barrier() warn: if();
drivers/md/raid10.c:995 wait_barrier() warn: ignoring unreachable code.
Old smatch warnings:
drivers/md/raid10.c:3220 raid10_sync_request() error: we previously assumed 'bio' could be null (see line 3212)
drivers/md/raid10.c:3225 raid10_sync_request() error: we previously assumed 'mreplace' could be null (see line 3111)
drivers/md/raid10.c:3575 calc_sectors() warn: should '1 << conf->geo.chunk_shift' be a 64 bit type?
vim +995 drivers/md/raid10.c
0a27ec96b6fb1a NeilBrown 2006-01-06 978
e879a8793f915a NeilBrown 2011-10-11 979 static void wait_barrier(struct r10conf *conf)
0a27ec96b6fb1a NeilBrown 2006-01-06 980 {
0a27ec96b6fb1a NeilBrown 2006-01-06 981 spin_lock_irq(&conf->resync_lock);
0a27ec96b6fb1a NeilBrown 2006-01-06 982 if (conf->barrier) {
fe630de009d072 Vitaly Mayatskikh 2020-03-03 983 struct bio_list *bio_list = current->bio_list;
0a27ec96b6fb1a NeilBrown 2006-01-06 984 conf->nr_waiting++;
d6b42dcb995e6a NeilBrown 2012-03-19 985 /* Wait for the barrier to drop.
d6b42dcb995e6a NeilBrown 2012-03-19 986 * However if there are already pending
d6b42dcb995e6a NeilBrown 2012-03-19 987 * requests (preventing the barrier from
d6b42dcb995e6a NeilBrown 2012-03-19 988 * rising completely), and the
d6b42dcb995e6a NeilBrown 2012-03-19 989 * pre-process bio queue isn't empty,
d6b42dcb995e6a NeilBrown 2012-03-19 990 * then don't wait, as we need to empty
d6b42dcb995e6a NeilBrown 2012-03-19 991 * that queue to get the nr_pending
d6b42dcb995e6a NeilBrown 2012-03-19 992 * count down.
d6b42dcb995e6a NeilBrown 2012-03-19 993 */
578b54ade8a5e0 NeilBrown 2016-11-14 994 raid10_log(conf->mddev, "wait barrier");
d6b42dcb995e6a NeilBrown 2012-03-19 @995 wait_event_lock_irq(conf->wait_barrier,
d6b42dcb995e6a NeilBrown 2012-03-19 996 !conf->barrier ||
0e5313e2d4ef93 Tomasz Majchrzak 2016-06-24 997 (atomic_read(&conf->nr_pending) &&
fe630de009d072 Vitaly Mayatskikh 2020-03-03 998 bio_list &&
fe630de009d072 Vitaly Mayatskikh 2020-03-03 999 (!bio_list_empty(&bio_list[0]) ||
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1000 !bio_list_empty(&bio_list[1]))) ||
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1001 /* move on if recovery thread is
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1002 * blocked by us
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1003 */
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1004 (conf->mddev->thread->tsk == current &&
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1005 test_bit(MD_RECOVERY_RUNNING,
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1006 &conf->mddev->recovery) &&
fe630de009d072 Vitaly Mayatskikh 2020-03-03 1007 conf->nr_queued > 0),
eed8c02e680c04 Lukas Czerner 2012-11-30 1008 conf->resync_lock);
0a27ec96b6fb1a NeilBrown 2006-01-06 1009 conf->nr_waiting--;
0e5313e2d4ef93 Tomasz Majchrzak 2016-06-24 1010 if (!conf->nr_waiting)
0e5313e2d4ef93 Tomasz Majchrzak 2016-06-24 1011 wake_up(&conf->wait_barrier);
0a27ec96b6fb1a NeilBrown 2006-01-06 1012 }
0e5313e2d4ef93 Tomasz Majchrzak 2016-06-24 1013 atomic_inc(&conf->nr_pending);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1014 spin_unlock_irq(&conf->resync_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1015 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1016
:::::: The code at line 995 was first introduced by commit
:::::: d6b42dcb995e6acd7cc276774e751ffc9f0ef4bf md/raid1,raid10: avoid deadlock during resync/recovery.
:::::: TO: NeilBrown <neilb@xxxxxxx>
:::::: CC: NeilBrown <neilb@xxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip