From patchwork Thu Mar 30 10:43:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193859 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 112F8C761A6 for ; Thu, 30 Mar 2023 10:44:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68AD36B0072; Thu, 30 Mar 2023 06:44:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63D046B0074; Thu, 30 Mar 2023 06:44:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DCC46B0075; Thu, 30 Mar 2023 06:44:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3BD016B0072 for ; Thu, 30 Mar 2023 06:44:10 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F13FC140E85 for ; Thu, 30 Mar 2023 10:44:09 +0000 (UTC) X-FDA: 80625229818.19.796DB95 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by imf24.hostedemail.com (Postfix) with ESMTP id D62C518001D for ; Thu, 30 Mar 2023 10:44:07 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=Miagi1B9; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf24.hostedemail.com: domain of "prvs=446327cdf=johannes.thumshirn@wdc.com" designates 216.71.153.141 as permitted sender) smtp.mailfrom="prvs=446327cdf=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680173048; 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=4c14CSmBtLh/HzpUYK0sfFAMpnWnZ9ahyS+6TCPJU1k=; b=Aa/mDb/F3MJ8x/yjLXg3pInDIaTyNraGVuw4SR91AJBJKdHc82CZlku9sc7CwXDD86jBvb IJEOgst+Ljpv3oK/1UJ0Ki3bN+KMBWgRbVKVTgZWOntDchq1uNz8OY5wK+TEVbItL+Jx2h 9j/BJTLTIj9B+6BjLTfI+a6EM5k9ll8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=Miagi1B9; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf24.hostedemail.com: domain of "prvs=446327cdf=johannes.thumshirn@wdc.com" designates 216.71.153.141 as permitted sender) smtp.mailfrom="prvs=446327cdf=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680173048; a=rsa-sha256; cv=none; b=oMgCqNghse8gLFDa/SstwgWdlprNNMByJlJFv1DVHGu/GasHc5xvvgS1VEXMSeSsVfgs32 dkt1vrI1RZyWaCx4+Etb+HaHMg1+C/lI6BVFdCgtCzNlBmOvceUbm2UPc4nc0on0aLKXtX WtZsxiAx8B9j2NxpQV/xOKhxsrfwD0o= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173047; x=1711709047; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pah75tbPpb3psPa1ecpfetIOIRQ7nD0HV9ZPD7l84bo=; b=Miagi1B9I+EQhAu39XbsrcgIfwP+5AX/MeDJrxk7olu0F11HnmhxWOi3 yuqkp4KE6IxBsWcPOvsPced7LccVTRw6tSy6qgCy16ETSYjCz/q7BTeCZ Sm6s0FicInnCgGzRJ/lGJx1+twuDe7Ehq3Cg2pSV8E7+VRKchWqjVwuaL 7363vXlVLCOhwTGSXypZhR+hQwyUeoFlg/wI6/fB5lRVHDkK1EP9DkrKN XVD1eCVjNNGRiJ8DnF4Ggcf/ybeCxFp4m7wNvBw3gyTkEWHSD+sDAXBbK LCVTjbS/wqsXV2Bc8YbBLBZ3iTkzO28wLZhqXepPcckuO6IuXAawqrErA g==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="231853881" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:06 +0800 IronPort-SDR: fparLvQD+seGxTTvqi+YwmLekQcV3leyh15+dVHC4JSo0SISZB2J/Zf59tLXtuUZRYQkyJLsKz J4u1yfEw07UaPBzifGTZNA1G7X2wBLGyicxfev1E0Rjxy5fdB+yoyw/U5Kd3SLTXZo0NW613Zy tiz78Ns/jEOZ1TAS3kFIHw+3YYgVdjX6fotfywyYcG8MJ4hj7+OsT3zBMZADZBkrJGyFtjSBU8 wyTAMOMfZLQxRY46oU3BaDGj8qChqL7W8tlhm1ykYEw6D7THsTazLCklutX5GFGvxWqhFPIxD3 hPI= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 02:54:33 -0700 IronPort-SDR: 7gJ8K2GWS1teEbx0EpcTaAq94qX8hrpZe2o+rF7L8m3YPiilRNcRHQOtOnWBcq5Kei46943ftQ AatOKxtS7MFwij2h5iQz2mMf16oXYsi9K+DB6MmYEWH2/wKf6Jhq67kl7/JyCoJSGg9MiCS+W9 mrW9LYIwkiiSRZtD5ihMJA2XMHB607JeeUDkojW0OuDyFEQQTb0fVeDCKSKcOQwZLNq8tnSX6N qQnaGAEAQ/tKNJ8ofe6AZpbyjdYyM/XDWamw0cI3BKjamWYlDUpPV17GiKF2irYNfORElYpHoT AxU= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:04 -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 v2 00/19] bio: check return values of bio_add_page Date: Thu, 30 Mar 2023 03:43:42 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: D62C518001D X-Stat-Signature: e5m39nxbrqfhimz8d4u9no36m6jhy1fh X-HE-Tag: 1680173047-368995 X-HE-Meta: U2FsdGVkX18JqOlc8RrVTpi78BZMjhzQJcbsaHoVJ6A55E1iHpjv21zWOqIj1UI2k+L55g6PkMWnmCX93/F6XQALSm5DNY45+75fSHxGUefNpi4IrsBYO35JpvQdT/G9JcIfKTnlseVr2DtG8PDjBWEuL2Vqb7sjD8tquJBRPHc5B4ZmEUstr4T6AEQ9xEYFS6ViT1MRAyqd95OyNze349hUDNO180YfDf12hC5Ivl1GbUrmjdJh3FuY2mMvHT1UKXpDuI9+mVQSawjmYs3irVnUnOv+4+PBf8nFL41or3reJXgM3WxmxwKVspqir6qrMAdCCpOoGxq9bJ2/w5PpUls7fOzG9HiTzNWDiUCtZ351F/boUXeXjeqpGmn7ew9oEx/dFb9sAJaxsqTB8Eq2GJMiQQt4bHSQOgTux8DA0wpnqQU57RUiN5RUngwPkVPUn9viR0xVlWCiJeeRCdWAjQSoYhBVWcR45lT9Fr+nDc4PT56p/e3m8iOhiev+ClhmFyRE8EY0ONsC3ri/ouaLeZQqTuAVOrsTW3rnfrKtC1M3bUlXOifxBCY2HKBWqbLQTKJ7o/UfHBnW6eVpK1xhnfC+AfDIB68T/BawJPJpT0SP8kSi53x6MSsH7DRtWaS+QaAVbnHA3jlcS3oYAFfQzHmsXsvl2Wy5mJBlqMTb+HYXwIDzqPgdJEmIcE0bkCYNmQkCHepWRgMHxzNg+a/PHGjlmMEaZtzYmo0M8s7GbTAW/O+oPDA3/PzhWhNxQhF9J0edZNVgALh5yd1VpWzHwj4ArxzyndSNliHSnGTST8UnPKxz0UXxNIqXjmuu/MkoqGZWKir8Kyo5dputiWIl6pELLroeYD0PogsYSvugJn8X4ORVtps/Bn56Uw6ay62hOPFY94bXzY/6MlOIhy5x7Ugj3LHv3okMSMHHOjAS8ypSCGl9VwQUBQ0XfrWPCmMWrHd7zlvsB/gVHov+zqH HuDesVe4 xY49vObTJLDgzTHKmw1XSrV22zy7NFT2JT+aVkigxdYe+fNVvDGu9r0PoN7Mxxfu15wdiIuBzThRY/IEvV2uI54K1yauNZ661CG1OuQF1NPrnx2OKAi9esr/8tNoPBNBmaR6sZblfwNyHTldRTxezW4/udWlP6QxQ9RZMUxxJ231/RsqzsgCOXfUFRDIYmG2x2IUiLrDhgxIXqpxYqFXGW2K3bWJx+iWYVVmGZl7PAgZleNw8yo0gpjphX6VUi7HZfBtIxLd29fFz/sf65LHV9dWlEMqiOK3rkl1JQfV3LyzNqNubTFuCXrVWiU71Pj87Y6cJ9ghMechaJ4L03VHIHu/ziTMojug1BJhO 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. 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 | 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, 50 insertions(+), 31 deletions(-)