[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008130611.P61KGZHY%lkp@intel.com>
Date: Thu, 13 Aug 2020 06:42:22 +0800
From: kernel test robot <lkp@...el.com>
To: "Ahmed S. Darwish" <a.darwish@...utronix.de>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>
Subject: drivers/md/raid5.c:7902 raid5_start_reshape() warn: statement has no
effect 31
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: 55f3560df975f557c48aa6afc636808f31ecb87a seqlock: Extend seqcount API with associated locks
date: 2 weeks ago
config: i386-randconfig-m031-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
New smatch warnings:
drivers/md/raid5.c:7902 raid5_start_reshape() warn: statement has no effect 31
Old smatch warnings:
drivers/md/raid5.c:6693 alloc_thread_groups() warn: double check that we're allocating correct size: 108 vs 1
drivers/md/raid5.c:6913 setup_conf() warn: should 'mddev->new_chunk_sectors << 9' be a 64 bit type?
drivers/md/raid5.c:7978 raid5_start_reshape() warn: statement has no effect 31
vim +7902 drivers/md/raid5.c
63c70c4f3a30e77 NeilBrown 2006-03-27 7860
fd01b88c75a7180 NeilBrown 2011-10-11 7861 static int raid5_start_reshape(struct mddev *mddev)
63c70c4f3a30e77 NeilBrown 2006-03-27 7862 {
d1688a6d5515f19 NeilBrown 2011-10-11 7863 struct r5conf *conf = mddev->private;
3cb03002000f133 NeilBrown 2011-10-11 7864 struct md_rdev *rdev;
63c70c4f3a30e77 NeilBrown 2006-03-27 7865 int spares = 0;
c04be0aa82ff535 NeilBrown 2006-10-03 7866 unsigned long flags;
63c70c4f3a30e77 NeilBrown 2006-03-27 7867
f416885ef495050 NeilBrown 2007-02-28 7868 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
63c70c4f3a30e77 NeilBrown 2006-03-27 7869 return -EBUSY;
63c70c4f3a30e77 NeilBrown 2006-03-27 7870
01ee22b496c4138 NeilBrown 2009-06-18 7871 if (!check_stripe_cache(mddev))
01ee22b496c4138 NeilBrown 2009-06-18 7872 return -ENOSPC;
01ee22b496c4138 NeilBrown 2009-06-18 7873
30b67645faadcdc NeilBrown 2012-05-22 7874 if (has_failed(conf))
30b67645faadcdc NeilBrown 2012-05-22 7875 return -EINVAL;
30b67645faadcdc NeilBrown 2012-05-22 7876
c6563a8c38fde3c NeilBrown 2012-05-21 7877 rdev_for_each(rdev, mddev) {
469518a3455c796 NeilBrown 2011-01-31 7878 if (!test_bit(In_sync, &rdev->flags)
1a940fcee31ec6c NeilBrown 2011-01-14 7879 && !test_bit(Faulty, &rdev->flags))
292695531ae4019 NeilBrown 2006-03-27 7880 spares++;
c6563a8c38fde3c NeilBrown 2012-05-21 7881 }
63c70c4f3a30e77 NeilBrown 2006-03-27 7882
f416885ef495050 NeilBrown 2007-02-28 7883 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
292695531ae4019 NeilBrown 2006-03-27 7884 /* Not enough devices even to make a degraded array
292695531ae4019 NeilBrown 2006-03-27 7885 * of that size
292695531ae4019 NeilBrown 2006-03-27 7886 */
292695531ae4019 NeilBrown 2006-03-27 7887 return -EINVAL;
292695531ae4019 NeilBrown 2006-03-27 7888
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7889 /* Refuse to reduce size of the array. Any reductions in
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7890 * array size must be through explicit setting of array_size
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7891 * attribute.
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7892 */
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7893 if (raid5_size(mddev, 0, conf->raid_disks + mddev->delta_disks)
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7894 < mddev->array_sectors) {
cc6167b4f3b3caa NeilBrown 2016-11-02 7895 pr_warn("md/raid:%s: array size must be reduced before number of disks\n",
cc6167b4f3b3caa NeilBrown 2016-11-02 7896 mdname(mddev));
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7897 return -EINVAL;
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7898 }
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7899
f67055780caac6a NeilBrown 2006-03-27 7900 atomic_set(&conf->reshape_stripes, 0);
292695531ae4019 NeilBrown 2006-03-27 7901 spin_lock_irq(&conf->device_lock);
c46501b2deaa06e NeilBrown 2013-08-27 @7902 write_seqcount_begin(&conf->gen_lock);
292695531ae4019 NeilBrown 2006-03-27 7903 conf->previous_raid_disks = conf->raid_disks;
63c70c4f3a30e77 NeilBrown 2006-03-27 7904 conf->raid_disks += mddev->delta_disks;
09c9e5fa1b93ad5 Andre Noll 2009-06-18 7905 conf->prev_chunk_sectors = conf->chunk_sectors;
09c9e5fa1b93ad5 Andre Noll 2009-06-18 7906 conf->chunk_sectors = mddev->new_chunk_sectors;
88ce4930e2b8037 NeilBrown 2009-03-31 7907 conf->prev_algo = conf->algorithm;
88ce4930e2b8037 NeilBrown 2009-03-31 7908 conf->algorithm = mddev->new_layout;
05616be5e11f668 NeilBrown 2012-05-21 7909 conf->generation++;
05616be5e11f668 NeilBrown 2012-05-21 7910 /* Code that selects data_offset needs to see the generation update
05616be5e11f668 NeilBrown 2012-05-21 7911 * if reshape_progress has been set - so a memory barrier needed.
05616be5e11f668 NeilBrown 2012-05-21 7912 */
05616be5e11f668 NeilBrown 2012-05-21 7913 smp_mb();
2c810cddc44d6f9 NeilBrown 2012-05-21 7914 if (mddev->reshape_backwards)
fef9c61fdfabf97 NeilBrown 2009-03-31 7915 conf->reshape_progress = raid5_size(mddev, 0, 0);
fef9c61fdfabf97 NeilBrown 2009-03-31 7916 else
fef9c61fdfabf97 NeilBrown 2009-03-31 7917 conf->reshape_progress = 0;
fef9c61fdfabf97 NeilBrown 2009-03-31 7918 conf->reshape_safe = conf->reshape_progress;
c46501b2deaa06e NeilBrown 2013-08-27 7919 write_seqcount_end(&conf->gen_lock);
292695531ae4019 NeilBrown 2006-03-27 7920 spin_unlock_irq(&conf->device_lock);
292695531ae4019 NeilBrown 2006-03-27 7921
4d77e3ba88d0858 NeilBrown 2013-08-27 7922 /* Now make sure any requests that proceeded on the assumption
4d77e3ba88d0858 NeilBrown 2013-08-27 7923 * the reshape wasn't running - like Discard or Read - have
4d77e3ba88d0858 NeilBrown 2013-08-27 7924 * completed.
4d77e3ba88d0858 NeilBrown 2013-08-27 7925 */
4d77e3ba88d0858 NeilBrown 2013-08-27 7926 mddev_suspend(mddev);
4d77e3ba88d0858 NeilBrown 2013-08-27 7927 mddev_resume(mddev);
4d77e3ba88d0858 NeilBrown 2013-08-27 7928
292695531ae4019 NeilBrown 2006-03-27 7929 /* Add some new drives, as many as will fit.
292695531ae4019 NeilBrown 2006-03-27 7930 * We know there are enough to make the newly sized array work.
3424bf6a772cff6 NeilBrown 2010-06-17 7931 * Don't add devices if we are reducing the number of
3424bf6a772cff6 NeilBrown 2010-06-17 7932 * devices in the array. This is because it is not possible
3424bf6a772cff6 NeilBrown 2010-06-17 7933 * to correctly record the "partially reconstructed" state of
3424bf6a772cff6 NeilBrown 2010-06-17 7934 * such devices during the reshape and confusion could result.
292695531ae4019 NeilBrown 2006-03-27 7935 */
87a8dec91e15954 NeilBrown 2011-01-31 7936 if (mddev->delta_disks >= 0) {
dafb20fa34320a4 NeilBrown 2012-03-19 7937 rdev_for_each(rdev, mddev)
292695531ae4019 NeilBrown 2006-03-27 7938 if (rdev->raid_disk < 0 &&
292695531ae4019 NeilBrown 2006-03-27 7939 !test_bit(Faulty, &rdev->flags)) {
199050ea1ff2270 Neil Brown 2008-06-28 7940 if (raid5_add_disk(mddev, rdev) == 0) {
87a8dec91e15954 NeilBrown 2011-01-31 7941 if (rdev->raid_disk
9d4c7d8799c4188 NeilBrown 2012-03-13 7942 >= conf->previous_raid_disks)
292695531ae4019 NeilBrown 2006-03-27 7943 set_bit(In_sync, &rdev->flags);
9d4c7d8799c4188 NeilBrown 2012-03-13 7944 else
9eb07c259207d04 NeilBrown 2010-02-09 7945 rdev->recovery_offset = 0;
36fad858a7404a9 Namhyung Kim 2011-07-27 7946
36fad858a7404a9 Namhyung Kim 2011-07-27 7947 if (sysfs_link_rdev(mddev, rdev))
00bcb4ac7ee7e55 NeilBrown 2010-06-01 7948 /* Failure here is OK */;
50da08409654e03 NeilBrown 2011-01-31 7949 }
1a940fcee31ec6c NeilBrown 2011-01-14 7950 } else if (rdev->raid_disk >= conf->previous_raid_disks
1a940fcee31ec6c NeilBrown 2011-01-14 7951 && !test_bit(Faulty, &rdev->flags)) {
1a940fcee31ec6c NeilBrown 2011-01-14 7952 /* This is a spare that was manually added */
1a940fcee31ec6c NeilBrown 2011-01-14 7953 set_bit(In_sync, &rdev->flags);
292695531ae4019 NeilBrown 2006-03-27 7954 }
292695531ae4019 NeilBrown 2006-03-27 7955
87a8dec91e15954 NeilBrown 2011-01-31 7956 /* When a reshape changes the number of devices,
87a8dec91e15954 NeilBrown 2011-01-31 7957 * ->degraded is measured against the larger of the
87a8dec91e15954 NeilBrown 2011-01-31 7958 * pre and post number of devices.
87a8dec91e15954 NeilBrown 2011-01-31 7959 */
c04be0aa82ff535 NeilBrown 2006-10-03 7960 spin_lock_irqsave(&conf->device_lock, flags);
2e38a37f23c98d7 Song Liu 2017-01-24 7961 mddev->degraded = raid5_calc_degraded(conf);
c04be0aa82ff535 NeilBrown 2006-10-03 7962 spin_unlock_irqrestore(&conf->device_lock, flags);
ec32a2bd35bd6b9 NeilBrown 2009-03-31 7963 }
63c70c4f3a30e77 NeilBrown 2006-03-27 7964 mddev->raid_disks = conf->raid_disks;
e516402c0d4fc02 NeilBrown 2009-08-03 7965 mddev->reshape_position = conf->reshape_progress;
2953079c692da06 Shaohua Li 2016-12-08 7966 set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);
f67055780caac6a NeilBrown 2006-03-27 7967
292695531ae4019 NeilBrown 2006-03-27 7968 clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
292695531ae4019 NeilBrown 2006-03-27 7969 clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
ea358cd0d2c634f NeilBrown 2015-06-12 7970 clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
292695531ae4019 NeilBrown 2006-03-27 7971 set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
292695531ae4019 NeilBrown 2006-03-27 7972 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
292695531ae4019 NeilBrown 2006-03-27 7973 mddev->sync_thread = md_register_thread(md_do_sync, mddev,
0da3c6194ec2f32 NeilBrown 2009-09-23 7974 "reshape");
292695531ae4019 NeilBrown 2006-03-27 7975 if (!mddev->sync_thread) {
292695531ae4019 NeilBrown 2006-03-27 7976 mddev->recovery = 0;
292695531ae4019 NeilBrown 2006-03-27 7977 spin_lock_irq(&conf->device_lock);
ba8805b97320416 NeilBrown 2013-11-14 7978 write_seqcount_begin(&conf->gen_lock);
292695531ae4019 NeilBrown 2006-03-27 7979 mddev->raid_disks = conf->raid_disks = conf->previous_raid_disks;
ba8805b97320416 NeilBrown 2013-11-14 7980 mddev->new_chunk_sectors =
ba8805b97320416 NeilBrown 2013-11-14 7981 conf->chunk_sectors = conf->prev_chunk_sectors;
ba8805b97320416 NeilBrown 2013-11-14 7982 mddev->new_layout = conf->algorithm = conf->prev_algo;
05616be5e11f668 NeilBrown 2012-05-21 7983 rdev_for_each(rdev, mddev)
05616be5e11f668 NeilBrown 2012-05-21 7984 rdev->new_data_offset = rdev->data_offset;
05616be5e11f668 NeilBrown 2012-05-21 7985 smp_wmb();
ba8805b97320416 NeilBrown 2013-11-14 7986 conf->generation --;
fef9c61fdfabf97 NeilBrown 2009-03-31 7987 conf->reshape_progress = MaxSector;
1e3fa9bd5061778 NeilBrown 2012-03-13 7988 mddev->reshape_position = MaxSector;
ba8805b97320416 NeilBrown 2013-11-14 7989 write_seqcount_end(&conf->gen_lock);
292695531ae4019 NeilBrown 2006-03-27 7990 spin_unlock_irq(&conf->device_lock);
292695531ae4019 NeilBrown 2006-03-27 7991 return -EAGAIN;
292695531ae4019 NeilBrown 2006-03-27 7992 }
c8f517c444e4f9f NeilBrown 2009-03-31 7993 conf->reshape_checkpoint = jiffies;
292695531ae4019 NeilBrown 2006-03-27 7994 md_wakeup_thread(mddev->sync_thread);
292695531ae4019 NeilBrown 2006-03-27 7995 md_new_event(mddev);
292695531ae4019 NeilBrown 2006-03-27 7996 return 0;
292695531ae4019 NeilBrown 2006-03-27 7997 }
292695531ae4019 NeilBrown 2006-03-27 7998
:::::: The code at line 7902 was first introduced by commit
:::::: c46501b2deaa06efcaaf82917281941f02c6b307 md/raid5: use seqcount to protect access to shape in make_request.
:::::: TO: NeilBrown <neilb@...e.de>
:::::: CC: NeilBrown <neilb@...e.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (28720 bytes)
Powered by blists - more mailing lists