tree:
git://git.infradead.org/users/hch/block.git bio_alloc-cleanup
head: 152c964c974a6e3bf0dd15a8d100c075087d5186
commit: 192922838a1e77811c20c6b8973983a5939edee2 [5/13] drbd: bio_alloc can't fail if
it is allow to sleep
config: x86_64-randconfig-a005
(
https://download.01.org/0day-ci/archive/20220112/202201122200.NLmBK6N6-lk...)
compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
244dd2913a43a200f5a6544d424cdc37b771028b)
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
git remote add hch-block
git://git.infradead.org/users/hch/block.git
git fetch --no-tags hch-block bio_alloc-cleanup
git checkout 192922838a1e77811c20c6b8973983a5939edee2
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir
ARCH=x86_64 SHELL=/bin/bash drivers/block/drbd/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> drivers/block/drbd/drbd_receiver.c:1725:1: warning: unused label
'fail' [-Wunused-label]
fail:
^~~~~
1 warning generated.
vim +/fail +1725 drivers/block/drbd/drbd_receiver.c
9104d31a759fba Lars Ellenberg 2016-06-14 1618
9104d31a759fba Lars Ellenberg 2016-06-14 1619
6ec2a0f2bc07d4 Lee Jones 2021-03-12 1620 /*
fbe29dec986223 Andreas Gruenbacher 2011-02-17 1621 * drbd_submit_peer_request()
b30ab7913b0a7b Andreas Gruenbacher 2011-07-03 1622 * @device: DRBD device.
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1623 * @peer_req: peer request
10f6d9926cd17a Lars Ellenberg 2011-01-24 1624 *
10f6d9926cd17a Lars Ellenberg 2011-01-24 1625 * May spread the pages to multiple
bios,
10f6d9926cd17a Lars Ellenberg 2011-01-24 1626 * depending on bio_add_page
restrictions.
10f6d9926cd17a Lars Ellenberg 2011-01-24 1627 *
10f6d9926cd17a Lars Ellenberg 2011-01-24 1628 * Returns 0 if all bios have been
submitted,
10f6d9926cd17a Lars Ellenberg 2011-01-24 1629 * -ENOMEM if we could not allocate
enough bios,
10f6d9926cd17a Lars Ellenberg 2011-01-24 1630 * -ENOSPC (any better suggestion?)
if we have not been able to bio_add_page a
10f6d9926cd17a Lars Ellenberg 2011-01-24 1631 * single page to an empty bio
(which should never happen and likely indicates
10f6d9926cd17a Lars Ellenberg 2011-01-24 1632 * that the lower level IO stack is
in some way broken). This has been observed
10f6d9926cd17a Lars Ellenberg 2011-01-24 1633 * on certain Xen deployments.
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1634 */
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1635 /* TODO allocate from our own
bio_set. */
b30ab7913b0a7b Andreas Gruenbacher 2011-07-03 1636 int drbd_submit_peer_request(struct
drbd_device *device,
fbe29dec986223 Andreas Gruenbacher 2011-02-17 1637 struct drbd_peer_request
*peer_req,
bb3cc85e16431b Mike Christie 2016-06-05 1638 const unsigned op, const
unsigned op_flags,
bb3cc85e16431b Mike Christie 2016-06-05 1639 const int fault_type)
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1640 {
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1641 struct bio *bios = NULL;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1642 struct bio *bio;
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1643 struct page *page =
peer_req->pages;
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1644 sector_t sector =
peer_req->i.sector;
11f8b2b69d32d4 Andreas Gruenbacher 2014-09-11 1645 unsigned data_size =
peer_req->i.size;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1646 unsigned n_bios = 0;
11f8b2b69d32d4 Andreas Gruenbacher 2014-09-11 1647 unsigned nr_pages = (data_size +
PAGE_SIZE -1) >> PAGE_SHIFT;
10f6d9926cd17a Lars Ellenberg 2011-01-24 1648 int err = -ENOMEM;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1649
dd4f699da67401 Lars Ellenberg 2016-06-14 1650 /* TRIM/DISCARD: for now, always use
the helper function
dd4f699da67401 Lars Ellenberg 2016-06-14 1651 * blkdev_issue_zeroout(...,
discard=true).
dd4f699da67401 Lars Ellenberg 2016-06-14 1652 * It's synchronous, but it does
the right thing wrt. bio splitting.
dd4f699da67401 Lars Ellenberg 2016-06-14 1653 * Correctness first, performance
later. Next step is to code an
dd4f699da67401 Lars Ellenberg 2016-06-14 1654 * asynchronous variant of the
same.
dd4f699da67401 Lars Ellenberg 2016-06-14 1655 */
f31e583aa2c208 Lars Ellenberg 2018-12-20 1656 if (peer_req->flags &
(EE_TRIM|EE_WRITE_SAME|EE_ZEROOUT)) {
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1657 /* wait for all pending IO
completions, before we start
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1658 * zeroing things out. */
5dd2ca1912714a Andreas Gruenbacher 2014-08-11 1659
conn_wait_active_ee_empty(peer_req->peer_device->connection);
45d2933c921c51 Lars Ellenberg 2014-04-23 1660 /* add it to the active list now,
45d2933c921c51 Lars Ellenberg 2014-04-23 1661 * so we can find it to present it
in debugfs */
21ae5d7f95aa1a Lars Ellenberg 2014-05-05 1662 peer_req->submit_jif = jiffies;
21ae5d7f95aa1a Lars Ellenberg 2014-05-05 1663 peer_req->flags |=
EE_SUBMITTED;
700ca8c04a0f44 Philipp Reisner 2016-06-14 1664
700ca8c04a0f44 Philipp Reisner 2016-06-14 1665 /* If this was a resync request
from receive_rs_deallocated(),
700ca8c04a0f44 Philipp Reisner 2016-06-14 1666 * it is already on the sync_ee
list */
700ca8c04a0f44 Philipp Reisner 2016-06-14 1667 if
(list_empty(&peer_req->w.list)) {
45d2933c921c51 Lars Ellenberg 2014-04-23 1668
spin_lock_irq(&device->resource->req_lock);
45d2933c921c51 Lars Ellenberg 2014-04-23 1669
list_add_tail(&peer_req->w.list, &device->active_ee);
45d2933c921c51 Lars Ellenberg 2014-04-23 1670
spin_unlock_irq(&device->resource->req_lock);
700ca8c04a0f44 Philipp Reisner 2016-06-14 1671 }
700ca8c04a0f44 Philipp Reisner 2016-06-14 1672
f31e583aa2c208 Lars Ellenberg 2018-12-20 1673 if (peer_req->flags &
(EE_TRIM|EE_ZEROOUT))
f31e583aa2c208 Lars Ellenberg 2018-12-20 1674
drbd_issue_peer_discard_or_zero_out(device, peer_req);
9104d31a759fba Lars Ellenberg 2016-06-14 1675 else /* EE_WRITE_SAME */
9104d31a759fba Lars Ellenberg 2016-06-14 1676 drbd_issue_peer_wsame(device,
peer_req);
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1677 return 0;
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1678 }
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1679
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1680 /* In most cases, we will only need
one bio. But in case the lower
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1681 * level restrictions happen to be
different at this offset on this
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1682 * side than those of the sending
peer, we may need to submit the
9476f39d66041c Lars Ellenberg 2011-02-23 1683 * request in more than one bio.
9476f39d66041c Lars Ellenberg 2011-02-23 1684 *
9476f39d66041c Lars Ellenberg 2011-02-23 1685 * Plain bio_alloc is good enough
here, this is no DRBD internally
9476f39d66041c Lars Ellenberg 2011-02-23 1686 * generated bio, but a bio
allocated on behalf of the peer.
9476f39d66041c Lars Ellenberg 2011-02-23 1687 */
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1688 next_bio:
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1689 bio = bio_alloc(GFP_NOIO,
nr_pages);
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1690 /* > peer_req->i.sector,
unless this is the first bio */
4f024f3797c43c Kent Overstreet 2013-10-11 1691 bio->bi_iter.bi_sector = sector;
74d46992e0d9de Christoph Hellwig 2017-08-23 1692 bio_set_dev(bio,
device->ldev->backing_bdev);
bb3cc85e16431b Mike Christie 2016-06-05 1693 bio_set_op_attrs(bio, op,
op_flags);
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1694 bio->bi_private = peer_req;
fcefa62e4c26e7 Andreas Gruenbacher 2011-02-17 1695 bio->bi_end_io =
drbd_peer_request_endio;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1696
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1697 bio->bi_next = bios;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1698 bios = bio;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1699 ++n_bios;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1700
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1701 page_chain_for_each(page) {
11f8b2b69d32d4 Andreas Gruenbacher 2014-09-11 1702 unsigned len = min_t(unsigned,
data_size, PAGE_SIZE);
06efffda51d978 Ming Lei 2016-11-11 1703 if (!bio_add_page(bio, page, len,
0))
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1704 goto next_bio;
11f8b2b69d32d4 Andreas Gruenbacher 2014-09-11 1705 data_size -= len;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1706 sector += len >> 9;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1707 --nr_pages;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1708 }
11f8b2b69d32d4 Andreas Gruenbacher 2014-09-11 1709 D_ASSERT(device, data_size == 0);
a0fb3c47a1aae5 Lars Ellenberg 2014-04-28 1710 D_ASSERT(device, page == NULL);
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1711
db830c464b69e2 Andreas Gruenbacher 2011-02-04 1712
atomic_set(&peer_req->pending_bios, n_bios);
21ae5d7f95aa1a Lars Ellenberg 2014-05-05 1713 /* for debugfs: update timestamp,
mark as submitted */
21ae5d7f95aa1a Lars Ellenberg 2014-05-05 1714 peer_req->submit_jif = jiffies;
21ae5d7f95aa1a Lars Ellenberg 2014-05-05 1715 peer_req->flags |= EE_SUBMITTED;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1716 do {
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1717 bio = bios;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1718 bios = bios->bi_next;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1719 bio->bi_next = NULL;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1720
ed00aabd5eb9fb Christoph Hellwig 2020-07-01 1721 drbd_submit_bio_noacct(device,
fault_type, bio);
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1722 } while (bios);
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1723 return 0;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1724
45bb912bd5ea4d Lars Ellenberg 2010-05-14 @1725 fail:
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1726 while (bios) {
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1727 bio = bios;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1728 bios = bios->bi_next;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1729 bio_put(bio);
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1730 }
10f6d9926cd17a Lars Ellenberg 2011-01-24 1731 return err;
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1732 }
45bb912bd5ea4d Lars Ellenberg 2010-05-14 1733
:::::: The code at line 1725 was first introduced by commit
:::::: 45bb912bd5ea4d2b3a270a93cbdf767a0e2df6f5 drbd: Allow drbd_epoch_entries to use
multiple bios. This should allow for better performance if the lower level IO stack of the
peers differs in limits exposed either via the queue, or via some merge_bvec_fn.
:::::: TO: Lars Ellenberg <lars.ellenberg(a)linbit.com>
:::::: CC: Philipp Reisner <philipp.reisner(a)linbit.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org