From patchwork Tue May 2 10:19:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13228673 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBA65C7EE2C for ; Tue, 2 May 2023 10:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683022847; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ccJA+UPDqut5iBDaoFMl/55gDfdxJpk9brOED8fRyHQ=; b=I6qcOwFHI50m0wZygYGP3gtd8CD2E1f22YX25J6Nn7+QFPejl5/5XPh5w4C28j0x19xqq9 Cce1hnwQLqqHZ2I9yX83UoI9YmA9M4QIdHoEPdTX8VupSTJDe1VpbUaFZmvbXfcT/mejvy KA0zHsovhs/kOmkdF0PnaoAo7bexPjg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-HEPkKVxmOFSOkFEyxVsGmA-1; Tue, 02 May 2023 06:20:46 -0400 X-MC-Unique: HEPkKVxmOFSOkFEyxVsGmA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B6E688B7A1; Tue, 2 May 2023 10:20:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D2C963F4A; Tue, 2 May 2023 10:20:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 47EA5194658C; Tue, 2 May 2023 10:20:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 912321946589 for ; Tue, 2 May 2023 10:20:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8213FC15BAE; Tue, 2 May 2023 10:20:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 789D1C15BAD for ; Tue, 2 May 2023 10:20:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E0471C04182 for ; Tue, 2 May 2023 10:20:41 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-ZuW5_5pBMYO3jxT0Kj3eDQ-1; Tue, 02 May 2023 06:20:37 -0400 X-MC-Unique: ZuW5_5pBMYO3jxT0Kj3eDQ-1 X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747104" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:20:35 +0800 IronPort-SDR: j+h5y73+MIMWjL5OO96R8MC30como6UW9hw9e0Tb33CZuXsWXPADOt0yOSLsPA3M3cC300DJmW G2wbBU3+jF9XZSt4lDRnS58ZJIZYOX3fsls4vgC631FTqxtAT7KYQ8mVpUIPlL0g84/JO2R2na 0YTUkMC/sviS+GDXXOeBo8fMwq/0js5P7KcWWCBGHZurfOvyo93JKFTaiZ28P/Y+UrJZ2rrQ3/ Grb0xP09Y4dFnZzTJcv/NaXbHHFZcgI9DUFolbUrMj+iuv1LRDxq2TwimPJCpak+KLqfMK5Pq5 hxE= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 May 2023 02:30:23 -0700 IronPort-SDR: II0VPVGqsVVzFv+CDBgRTuszrP/jrhnqWD28hz4KmIk0OWZ9iuuunBJznbIJJEWysUomM83PbW tHpIqF+Wkzt60j425jkVHSTfRN97pvpj4qRJGP1XK/rYUtVFMFwW07KYIR+NBQHS3CcgY7qgcQ QoPqPucc39VmFll8EWhRke9TeNwUD/RetNk6TeKPQdBhijuGDl8aTzuwdYvSvt9Rua9BZLT2+I uqumhMLeAhgcuUfutHNKva+v42l5kJ3gIfcZswnraO/ApNiUR1Ze30swYPZMzn8zkEyKLhcsrU NTE= WDCIronportException: Internal Received: from myd008205.ad.shared (HELO localhost.localdomain) ([10.225.1.100]) by uls-op-cesaip02.wdc.com with ESMTP; 02 May 2023 03:20:32 -0700 From: Johannes Thumshirn To: "axboe @ kernel . dk" Date: Tue, 2 May 2023 12:19:14 +0200 Message-Id: <20230502101934.24901-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Subject: [dm-devel] [PATCH v5 00/20] bio: check return values of bio_add_page X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-block@vger.kernel.org, damien.lemoal@wdc.com, kch@nvidia.com, agruenba@redhat.com, shaggy@kernel.org, song@kernel.org, Johannes Thumshirn , snitzer@kernel.org, jfs-discussion@lists.sourceforge.net, willy@infradead.org, ming.lei@redhat.com, cluster-devel@redhat.com, linux-mm@kvack.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-raid@vger.kernel.org, hch@lst.de, rpeterso@redhat.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: wdc.com 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. Changes to v4: - Rebased onto latest Linus' master - Dropped already merged patches - Added Sergey's Reviewed-by Changes to v3: - Added __bio_add_folio and use it in iomap (Willy) - Mark bio_add_folio must check (Willy) - s/GFS/GFS2/ (Andreas) Changes to v2: - Removed 'wont fail' comments pointed out by Song Changes to v1: - Removed pointless comment pointed out by Willy - Changed commit messages pointed out by Damien - Colledted Damien's Reviews and Acks Johannes Thumshirn (20): 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 jfs: logmgr: use __bio_add_page to add single page to bio gfs2: 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 block: add __bio_add_folio fs: iomap: use __bio_add_folio where possible block: mark bio_add_folio as __must_check block/bio.c | 8 ++++++++ drivers/block/drbd/drbd_bitmap.c | 4 +--- 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 | 11 ++++++----- drivers/md/raid1.c | 7 +++++-- drivers/md/raid10.c | 20 ++++++++++---------- drivers/md/raid5-cache.c | 2 +- drivers/md/raid5-ppl.c | 4 ++-- fs/buffer.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- fs/iomap/buffered-io.c | 6 +++--- fs/jfs/jfs_logmgr.c | 4 ++-- fs/zonefs/super.c | 2 +- include/linux/bio.h | 5 +++-- mm/page_io.c | 8 ++++---- 19 files changed, 63 insertions(+), 45 deletions(-) base-commit: 865fdb08197e657c59e74a35fa32362b12397f58