From patchwork Wed Mar 29 17:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13192949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79CC1C74A5B for ; Wed, 29 Mar 2023 17:06:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C89C56B0072; Wed, 29 Mar 2023 13:06:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C12A56B0074; Wed, 29 Mar 2023 13:06:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A654D6B0075; Wed, 29 Mar 2023 13:06:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 913466B0072 for ; Wed, 29 Mar 2023 13:06:27 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5E2AA140DA1 for ; Wed, 29 Mar 2023 17:06:27 +0000 (UTC) X-FDA: 80622564414.09.133E0A3 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by imf21.hostedemail.com (Postfix) with ESMTP id 18E451C002A for ; Wed, 29 Mar 2023 17:06:23 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LqgyM1pb; spf=pass (imf21.hostedemail.com: domain of "prvs=445a3f1bb=johannes.thumshirn@wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=445a3f1bb=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680109584; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Q0vXrB3YpVAqkHmAwqjSYymJe2xmB6NI0kEVCyloRK4=; b=7u5T5ePiOXGqxEMOhbeG2leSTdMso4GNDAjsP0pZ8qry17jLtkfQYqbh4GI9GM1T77LTla RpxbLHsJ++fJjzoGIDZAL/ZO4JGZ5YhPRpP29oaLneJkbZyQ/tDeSW8FfM2Zs2L5gUb858 ay7RriLSdzlQMOEhMCgjQK7OJVPkJx8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LqgyM1pb; spf=pass (imf21.hostedemail.com: domain of "prvs=445a3f1bb=johannes.thumshirn@wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=445a3f1bb=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680109584; a=rsa-sha256; cv=none; b=XINjs3u0c15Izkx9xF2r2+TmjawaRKqe0Dx7DifeebfAOPd2I2V3LixowsBubCBs7J4J0l sOMQT7qArgJVZ1yg+UFswzEkwZevoc1OkICkgsObnjCKtm4ujlJvsqXwrZgNCAvLOpIQgQ aSxWeylYfD7miY9vNsaH3eShLcVUeCI= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680109584; x=1711645584; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+NnexQOsAOUbE/augeQOa8oyAzkSCsYrdZjdeoHBcjs=; b=LqgyM1pb2MDmayMvV2JlQl0na3EzJpAbeCO71AFpl+6InKLN8HWMijvd sXsyJhLPF2qMXM0gYTOB4k984+rCy5urPc/LuYyzR9Aqzm4r7yeaFQxkU FxseSCsnmdy+G5vA1AXrOWVUZnflPKjOzm3arsWMIG9GbB+48BF4sW7fv ZipxQ8QLECeMQ7GwDyPFlnFBOkENobZbiQydrJ7+0B86X8m56qS96tdc2 W/SeM+gcEJNP0l3AOZXW2zxOcy3r+7VFU3WX8CXufB1LrDuH9gHz6PkWY UaCYFpIuPkBv6zEPfIoFnstJBplbmDJQFQoM9UanYGUVYLhm+UbHC51aP g==; X-IronPort-AV: E=Sophos;i="5.98,301,1673884800"; d="scan'208";a="226806997" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 01:06:21 +0800 IronPort-SDR: 8py+MdABWSu7w94xHYIdDLtgnGBfsJWTxXIFDAaRfeUm45eRQHEyz5KEmKoCF0gFFHJ6Hkon/z jn7SpUoXTbLPaxPv9KjRwWhaC9Vd1pdjr5vQVhgo+Hg++1ZoHAjk40K1dpVlFY2k1KsLFnB5Fc lXFHzp0t8fTipVQxkh/4ATQedHPlIEeVOnY4ozbIoxeVaHyaHSWA0A2VMUceM/S0xozBKxQllu tbDaUQ76c1Z/Jh2WLbGgfa10kb7/g0MX9SxuAyDGzRgqNKa7lXcXOYnpXP+X1KtmXUwBkvSjhB T9o= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 09:22:30 -0700 IronPort-SDR: 5o43zE44ApvlLKedTs27i6ZN/lELa7pMrmIJQK40gUpdn2C4UtQdcwlIfjiKh1n/bPpGX2YXq8 YJJVJzgPqspxZi96lPe0WBzcRw9V0Z9BQK2DV4YAFsTQkHP1VrCBf6vXbgxIZ7J5vpxE0lTn/0 xSGPZVtghIG7ljFrff33/jPHtv9RuCOmJLd+y2rtbDipZfTukm+09qiddbRkAF472QN1YGPAI9 JwRocCI6ASGu/e1WbcS3qvfbyDLv4KkKB37h7xOPvZEpnFh7bqGxuER/H3ZfH5Gd/fUWjoHgjr ZXs= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Mar 2023 10:06:20 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 00/19] bio: check return values of bio_add_page Date: Wed, 29 Mar 2023 10:05:46 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 18E451C002A X-Stat-Signature: j9krb5wyyngi6fdgfgapts6y1z556qae X-Rspam-User: X-HE-Tag: 1680109583-567051 X-HE-Meta: U2FsdGVkX18DCbPkiFVmlov6GGxC3DfuR1+IPiLafNi6Lp4CNDqFQyc/kXjcpxheG6Luj8nDov+ZqezTMAwHE1VK1G74z1MH1pl7tvb6ZTjX9H6Dn+KsVpPY9q0kQD01/XUDoB6fCAf2p3F7e1szW1Dy3Z8XsXFbBcG7nn3qXAlM6/OyGyIIvNmde6se0p1QMQW/fmjXHsD+50sz+ZODJBXl3/FloRqitPFU4ngHqYN2i7YteqtLpZZPGh9+cDxh8wfIksP6qJY+UEyi3N+/40JUChuU3t2jHuaVx4WhwWeyZ7y/whCZnkaV5587Zj/XSgIl9g+M3RasSk7DkHD9t8SYfVa7CejlrY5giKhVpWsxUW4thvnIQZCvUwfpUL7OcjOTZRphGTRTWohxMPaBYvA6CeHAekILNN7wnwZKZj32ncpHan/OoaGLsGVEop23K96XPvCn1LllDKOuqe71D5RxwXn5vIoJP6oDvPZBEGxzDqMqtDzasMUQUBNPEqHI+DIa6osk0V0n7WIjjdp910bj57HO7yhbvJEEJvlLUekjm1C2S8ZVZmMeF7lNa4K9SH8DgjpXDGsvfBn21gBMy5p3x7jP2MaXSlnLM5uODzgklTDWXoS3mccMe15T6SZY5I714jnBkYqpbNa2Q/hz0mg4ibULhMsROSCRhbM8F99HUXSyH3xQP1ExF8UnJjXR9eojGrt9cnkJ9hUZ8VYkQ/EoY4cwQJURAsMyAkjsfoIimfdfrv+rOhx+MvRU+OqId3Bvj/pOZ/nvwVPx/6DluF9LFlHeFDgFlsjdBcC8pRK47HmIVW/2duSqGp3/apjw3IrzcxAoqtfX+67yMVfVjkUrw+ufwTx7PeGM6WVeOXsq9YLdwvHMme6DazrPQfqif46DGjX3Rjjvk3vItKA9tRd1NNqaEz0lj5/sSAJBEaMJ2F7bOyvZc6VaUp7fIEgTcpHKhJrcEodijDG16hR 7hCwS2fZ fplsWOydImodoGxxDO33IHOvb4UdHEmBTripzzGXg2CYmQMh1DOenWPQbTdqttmQ1ezbGF0LIRydpqGLGLxhlrohNfypJzC/MAF8g/cczI5NRPeWhPljXoiPdYlbMXMCvRWZ10jmhNFUrZbm3HBnAr/uujOqgkl8l66meO1EbWpvyXkua/jwHgOnTruvZkJRpNgEDz7od1I0U1lZCw6c+waJnGMvaYMf/QN8aDBPQts3ItmQSj/qyhDPZLz3YKumPeL9ImGYqC3I+OBCcrYyKH1bXo+sFoCEFQmLvz9lsLdPhoX1WXrAp3Ceu5ZSplUMST1RUWj+ZbSzs0M8cX/0gdc4/JsjSbrfgWSfP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We have two functions for adding a page to a bio, __bio_add_page() which is used to add a single page to a freshly created bio and bio_add_page() which is used to add a page to an existing bio. While __bio_add_page() is expected to succeed, bio_add_page() can fail. This series converts the callers of bio_add_page() which can easily use __bio_add_page() to using it and checks the return of bio_add_page() for callers that don't work on a freshly created bio. Lastly it marks bio_add_page() as __must_check so we don't have to go again and audit all callers. Johannes Thumshirn (19): swap: use __bio_add_page to add page to bio drbd: use __bio_add_page to add page to bio dm: dm-zoned: use __bio_add_page for adding single metadata page fs: buffer: use __bio_add_page to add single page to bio md: use __bio_add_page to add single page md: raid5-log: use __bio_add_page to add single page md: raid5: use __bio_add_page to add single page to new bio btrfs: repair: use __bio_add_page for adding single page btrfs: raid56: use __bio_add_page to add single page jfs: logmgr: use __bio_add_page to add single page to bio gfs: use __bio_add_page for adding single page to bio zonefs: use __bio_add_page for adding single page to bio zram: use __bio_add_page for adding single page to bio floppy: use __bio_add_page for adding single page to bio md: check for failure when adding pages in alloc_behind_master_bio md: raid1: use __bio_add_page for adding single page to bio md: raid1: check if adding pages to resync bio fails dm-crypt: check if adding pages to clone bio fails block: mark bio_add_page as __must_check drivers/block/drbd/drbd_bitmap.c | 8 +++++--- drivers/block/floppy.c | 2 +- drivers/block/zram/zram_drv.c | 2 +- drivers/md/dm-crypt.c | 9 ++++++++- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/md.c | 4 ++-- drivers/md/raid1-10.c | 7 ++++++- drivers/md/raid1.c | 5 +++-- drivers/md/raid10.c | 12 ++++++++++-- drivers/md/raid5-cache.c | 2 +- drivers/md/raid5-ppl.c | 4 ++-- fs/btrfs/bio.c | 2 +- fs/btrfs/raid56.c | 2 +- fs/buffer.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- fs/jfs/jfs_logmgr.c | 4 ++-- fs/zonefs/super.c | 2 +- include/linux/bio.h | 2 +- mm/page_io.c | 8 ++++---- 19 files changed, 54 insertions(+), 31 deletions(-)