From patchwork Wed Apr 19 14:09:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13216871 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 7C329C6FD18 for ; Wed, 19 Apr 2023 14:10:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCE806B0071; Wed, 19 Apr 2023 10:10:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B57BB900003; Wed, 19 Apr 2023 10:10:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D0DB900002; Wed, 19 Apr 2023 10:10:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8B20B6B0071 for ; Wed, 19 Apr 2023 10:10:32 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1F3131A0294 for ; Wed, 19 Apr 2023 14:10:32 +0000 (UTC) X-FDA: 80698325904.25.DB2201F Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by imf24.hostedemail.com (Postfix) with ESMTP id 2536B18001E for ; Wed, 19 Apr 2023 14:10:29 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf24.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681913430; 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; bh=ds+4u+CqEC3ZGaEOp3gVvQ4zLD/cUEcU9lJQRjxdLNA=; b=09xKYi8eWgNT8OVEfR3xriSnZfmk1SGlKZo8wOkPJ8xGTu+msZiWGwwbsNoKHTIBzKbUpi UeYndAiDtSAm4ZScppUhNEGDem/+Ea9sNQ+wI4iiwHP0GuYdEvzLBZTD2PaSJLGXDj0Oeo RKE8J67KdWUVhkBv4+o3DUwWEOzFJfM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf24.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681913430; a=rsa-sha256; cv=none; b=nHEsFwQIa6N75YUmXK0qU6mnP0CBj3/uNkdwzWFjh36Ld3NuiREDLf5obomhXeOO4kKrtA IUBSc9Iyvqp5RDeNWVf9kuT2lDKJM0eVsCUrrk70hAultiiBR5pOstXsGCD5P6+Ix6XmCO kSsApY0w6ETsb5lcefvfVu1pY5op1vY= Received: by mail-wm1-f48.google.com with SMTP id n43-20020a05600c502b00b003f17466a9c1so1534747wmr.2 for ; Wed, 19 Apr 2023 07:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681913428; x=1684505428; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ds+4u+CqEC3ZGaEOp3gVvQ4zLD/cUEcU9lJQRjxdLNA=; b=DXKAY5/ousUacDgVXm80IRuuPNJ+yubM64PUQh6NeD4VxwHQujHxQ2dZz+nSL/uJ7A IS/LmMPtk1DSa/ImqnH/9S6px5d7bHGpTixlKl8oAG1yu/RqUPUpzA33+L3v0YeriM1X 2FZd2bDH12KfYxPE3ZjE+nxYQtWuLI/U8y2BeMhIk91FvfFnfQZ93AZ/pIh1dvFcd1OW 2FMNtJsoCQPJBg1qUEQ4+kLWwgM+AoEXhZOY41YsuXC6l28oxjdNSpMPqRUwL1uO7Xzm jJjgrNVZT8wBBFLnYZoXn3tGo3HqYJ+vVpCuUlzpKJwyUrt3zUf0pFpG0Bon/GiXELQv Talw== X-Gm-Message-State: AAQBX9e30wDseHsdY+Opy6FC+6fh6pPSUeK1asXrCPjT1OLDk6ds5sDD RGYodrQaD/gMCUOSEtUFHcY= X-Google-Smtp-Source: AKy350Y4xTG1OoU4RldSmLjAWxwSQmurOCS31djj2xM4db5/3zz7gZSX8s3hL+Z3d0qabHExFnk4cg== X-Received: by 2002:a05:600c:3ca2:b0:3f1:7371:86bb with SMTP id bg34-20020a05600c3ca200b003f1737186bbmr1907296wmb.20.1681913428480; Wed, 19 Apr 2023 07:10:28 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-204.dynamic.mnet-online.de. [62.216.205.204]) by smtp.googlemail.com with ESMTPSA id q17-20020a5d61d1000000b002faaa9a1721sm7612089wrv.58.2023.04.19.07.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 07:10:27 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, ming.lei@redhat.com, rpeterso@redhat.com, shaggy@kernel.org, snitzer@kernel.org, song@kernel.org, willy@infradead.org, Johannes Thumshirn Subject: [PATCH v3 00/19] bio: check return values of bio_add_page Date: Wed, 19 Apr 2023 16:09:10 +0200 Message-Id: <20230419140929.5924-1-jth@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 2536B18001E X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ygy1wbjjo35dz49x5nr37578k5fm9aw6 X-HE-Tag: 1681913429-973550 X-HE-Meta: U2FsdGVkX1/ha1PISon+ivq8A09fEx5yJ0Ya/7J/k0hCRdYV8nDjx1gIlhyY9FmeeNfmQxeLu9DZ0+wviad+MEjXiOb0a0Ty3I4q0+isdrJoOl5Vctg200QjhHi28tWDUINy+wL3CxRxirBJupZaaqyuIRPiCF1iUBHNtWosTlG9E0vAJLEuYVpJ5iyMRocAOiyxEvX0k30YqBiCqrEoYzUfHpcNd76Vu7MLN9Rn4jqJV/W33JATLX/W08VXuYwPCT+x16e0QWNbwewCi75f1UQFGjceKDgRXoS7IiRO66zMI8tLmeBPow9AkZJYJdSnMX7SOt8rprowuPnN5iz9CrZvFJXowcwdiWtpC6F8xjH2OSluejkbxaVWHIOxIwRGVTqjWT6hXkX32ean506yAXqlwod+KC3XBxreUQSbevtx+Eu9XHGBbm8cjwX1qyB3R5HEUpTUOvdcVACYFy03ScxrwDuT9o8HblW0G1hlXtno7c8qKxh1n6zK77FErlUIqYdnrQjJ3KvnAKg0ek2ykX9Q3KN9i1+86a+Sbud6o2Y9ywsv6AWz8yE+bIaEs0jMZxLvlQ+1NepyEcV+wxRfCz3mMZaT0siYfhmnO+q8xNV9cbhQ4LeOOCh6HdgGVkQiUcZrITm6i1WzTGlyvdNsLRnN+ZEnnhC4XmHE6JZmt4p8wWX/K+AvMZTfliE6uHd5JROuMm6va9PPKfMv723B2u8DFxs8DJbEAXYgEWJxVnFOtUkCdDxq4AsO+AQoqaoVTw6BnPq2kpX685nxIl0nwi46XnpxYL8atZd9svfugH2fvNyJzKdxS21gh6FERyMvT78S4GASfGML1Bydrg5Tm1CpwzzyqMdAg53+vDi8RLqC2JK/IYxK8oZs5htzZ79h6svBXL5pqV3Ze6hj0rbKbmKrTNrln6vYjyu+0Drqt+qlTFpb2MxgdY2skglNG4IoEZG1lWbXIqVqXc0fFHK Or+mpwwM 7lsHciQ9k9uaVGLg6cCudQLF8iu/vEzWsaTu9utU2jQAHIuPdx4aHQTaVpibIs+fY9PObmzTmuq27PBp83OWfXLUEVibWl+Kp8eBZJybd7SWkNhfDwPw6F/n2lvgs7ndPxPxlNQRkvHU+GEZnzWdQAyyFNMWuEEcmpqOZGCbZwXnj2IpTz8wIb1ejefkCWOhVpF4SmOF78RaKAURUV5zsmWV5vfw4s8kthqBCR67HueguVQ/OermU0AT52wauH5vQJI1+nwWyEgjgwXUC90fWYpQrvRy+gYHgAGJqyYHtAv1YQJ4Ia7bCy6lrg2PFrKr6iEelpxHp6lMy0X7FZ/Rys0Iy6p0cAFAUcZCmO3qSK9rRop1AOS6M29alKbNTJ+81xBYb06es2eqXH7N5N/5U0fdP1/WWmW5uhV+6FmjuWEL/+lDARar/EAcXV8Arbao1qnpOxmdLaPSzkOsmqt5234irxmbiGRZnJT9fb7xVf8XICz8y4ke4GvsYhBY4r1rrppLe 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. NOTE: David already applied the two btrfs patches to his tree but I've left them in the series to make the build bot happy. 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 (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 | 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/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, 52 insertions(+), 43 deletions(-) base-commit: af67688dca57999fd848f051eeea1d375ba546b2