[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202208050301.roHRxc6O-lkp@intel.com>
Date: Fri, 5 Aug 2022 12:08:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, Mikulas Patocka <mpatocka@...hat.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, Mike Snitzer <snitzer@...hat.com>
Subject: drivers/md/dm-writecache.c:1554 writecache_map() warn: inconsistent
returns '&wc->lock'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b44f2fd87919b5ae6e1756d4c7ba2cbba22238e1
commit: df699cc16ea5ef93a917676dcdd4376e02860ad5 dm writecache: report invalid return from writecache_map helpers
config: arc-randconfig-m041-20220804 (https://download.01.org/0day-ci/archive/20220805/202208050301.roHRxc6O-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
smatch warnings:
drivers/md/dm-writecache.c:1554 writecache_map() warn: inconsistent returns '&wc->lock'.
vim +1554 drivers/md/dm-writecache.c
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1484 static int writecache_map(struct dm_target *ti, struct bio *bio)
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1485 {
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1486 struct dm_writecache *wc = ti->private;
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1487 enum wc_map_op map_op;
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1488
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1489 bio->bi_private = NULL;
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1490
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1491 wc_lock(wc);
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1492
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1493 if (unlikely(bio->bi_opf & REQ_PREFLUSH)) {
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1494 map_op = writecache_map_flush(wc, bio);
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1495 goto done;
dcd195071f22d4 Mikulas Patocka 2020-01-15 1496 }
dcd195071f22d4 Mikulas Patocka 2020-01-15 1497
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1498 bio->bi_iter.bi_sector = dm_target_offset(ti, bio->bi_iter.bi_sector);
dcd195071f22d4 Mikulas Patocka 2020-01-15 1499
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1500 if (unlikely((((unsigned)bio->bi_iter.bi_sector | bio_sectors(bio)) &
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1501 (wc->block_size / 512 - 1)) != 0)) {
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1502 DMERR("I/O is not aligned, sector %llu, size %u, block size %u",
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1503 (unsigned long long)bio->bi_iter.bi_sector,
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1504 bio->bi_iter.bi_size, wc->block_size);
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1505 map_op = WC_MAP_ERROR;
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1506 goto done;
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1507 }
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1508
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1509 if (unlikely(bio_op(bio) == REQ_OP_DISCARD)) {
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1510 map_op = writecache_map_discard(wc, bio);
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1511 goto done;
48debafe4f2fea Mikulas Patocka 2018-03-08 1512 }
48debafe4f2fea Mikulas Patocka 2018-03-08 1513
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1514 if (bio_data_dir(bio) == READ)
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1515 map_op = writecache_map_read(wc, bio);
48debafe4f2fea Mikulas Patocka 2018-03-08 1516 else
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1517 map_op = writecache_map_write(wc, bio);
15cb6f39dbaf39 Mike Snitzer 2021-07-12 1518 done:
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1519 switch (map_op) {
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1520 case WC_MAP_REMAP_ORIGIN:
5c0de3d72f8c05 Mikulas Patocka 2021-06-28 1521 if (likely(wc->pause != 0)) {
5c0de3d72f8c05 Mikulas Patocka 2021-06-28 1522 if (bio_op(bio) == REQ_OP_WRITE) {
95b88f4d71cb95 Mikulas Patocka 2021-06-25 1523 dm_iot_io_begin(&wc->iot, 1);
95b88f4d71cb95 Mikulas Patocka 2021-06-25 1524 bio->bi_private = (void *)2;
95b88f4d71cb95 Mikulas Patocka 2021-06-25 1525 }
5c0de3d72f8c05 Mikulas Patocka 2021-06-28 1526 }
48debafe4f2fea Mikulas Patocka 2018-03-08 1527 bio_set_dev(bio, wc->dev->bdev);
48debafe4f2fea Mikulas Patocka 2018-03-08 1528 wc_unlock(wc);
48debafe4f2fea Mikulas Patocka 2018-03-08 1529 return DM_MAPIO_REMAPPED;
48debafe4f2fea Mikulas Patocka 2018-03-08 1530
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1531 case WC_MAP_REMAP:
48debafe4f2fea Mikulas Patocka 2018-03-08 1532 /* make sure that writecache_end_io decrements bio_in_progress: */
48debafe4f2fea Mikulas Patocka 2018-03-08 1533 bio->bi_private = (void *)1;
48debafe4f2fea Mikulas Patocka 2018-03-08 1534 atomic_inc(&wc->bio_in_progress[bio_data_dir(bio)]);
48debafe4f2fea Mikulas Patocka 2018-03-08 1535 wc_unlock(wc);
48debafe4f2fea Mikulas Patocka 2018-03-08 1536 return DM_MAPIO_REMAPPED;
48debafe4f2fea Mikulas Patocka 2018-03-08 1537
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1538 case WC_MAP_SUBMIT:
48debafe4f2fea Mikulas Patocka 2018-03-08 1539 wc_unlock(wc);
48debafe4f2fea Mikulas Patocka 2018-03-08 1540 bio_endio(bio);
48debafe4f2fea Mikulas Patocka 2018-03-08 1541 return DM_MAPIO_SUBMITTED;
48debafe4f2fea Mikulas Patocka 2018-03-08 1542
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1543 case WC_MAP_RETURN:
48debafe4f2fea Mikulas Patocka 2018-03-08 1544 wc_unlock(wc);
48debafe4f2fea Mikulas Patocka 2018-03-08 1545 return DM_MAPIO_SUBMITTED;
48debafe4f2fea Mikulas Patocka 2018-03-08 1546
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1547 case WC_MAP_ERROR:
48debafe4f2fea Mikulas Patocka 2018-03-08 1548 wc_unlock(wc);
48debafe4f2fea Mikulas Patocka 2018-03-08 1549 bio_io_error(bio);
48debafe4f2fea Mikulas Patocka 2018-03-08 1550 return DM_MAPIO_SUBMITTED;
df699cc16ea5ef Mikulas Patocka 2021-07-27 1551
df699cc16ea5ef Mikulas Patocka 2021-07-27 1552 default:
df699cc16ea5ef Mikulas Patocka 2021-07-27 1553 BUG();
df699cc16ea5ef Mikulas Patocka 2021-07-27 @1554 return -1;
This only warning only happens if you CONFIG_ the BUG() away. Hard to
tell how far we really care about dealing with impossible situations...
48debafe4f2fea Mikulas Patocka 2018-03-08 1555 }
cdd4d7832d51e0 Mike Snitzer 2021-07-12 1556 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists