From mboxrd@z Thu Jan 1 00:00:00 1970 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 3B8DAC74A5B for ; Wed, 29 Mar 2023 23:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680133503; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Qbar5hVtMDdUd2JaMnpiGkTvXnmFHUxjU9xQNpwvjCs=; b=fFlG/NbRZXBwVZtQpQa2nlRw97UlaeEcxoebui7i7HDTS4EznJjU2dt5H8ebDnKDPmNCjS 0kwkS9CAWbm3PZ4xFE00S2pmJzOCfEa/P8SW3JzHGotmwh1gKEDziCZiKfvF4+YBOVAMWh nQojrYA+vKuuYe+JMa1Rts1hJe03Scg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-4k_QQn_FObemAeXSHIHCYg-1; Wed, 29 Mar 2023 19:45:01 -0400 X-MC-Unique: 4k_QQn_FObemAeXSHIHCYg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0D2B1C05AC1; Wed, 29 Mar 2023 23:44:59 +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 5DBCEC15BA0; Wed, 29 Mar 2023 23:44:59 +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 46B5C1946588; Wed, 29 Mar 2023 23:44:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 810991946587 for ; Wed, 29 Mar 2023 23:44:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5FD2D492B02; Wed, 29 Mar 2023 23:44:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5798F492B00 for ; Wed, 29 Mar 2023 23:44:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 3BD37885621 for ; Wed, 29 Mar 2023 23:44:57 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-456-P2YwJGIBMN6ZaYoyew_mmg-2; Wed, 29 Mar 2023 19:44:55 -0400 X-MC-Unique: P2YwJGIBMN6ZaYoyew_mmg-2 X-IronPort-AV: E=Sophos;i="5.98,301,1673884800"; d="scan'208";a="225114141" 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 07:44:53 +0800 IronPort-SDR: lO7EdRb012Mp3KR0hyRQVTIUJRJbnvS9x2jyUj/6nzGy4qp4vgX2YdSLqzmxWt0rpKsirdhXfn VhVCbhUAs2t8m2NkdYpZnpDdRj/U3CveA4csx0mSt/5XxTdQNGJPh+HqOoQ2Rgo7qggXzeN4Gw q0+u5vRicDp3yPCo1xSSuhsSxeKEpiRs5+y24tJWKKBSgZhqkiI4sxJhBduOJNbQCGo/KFpDQ7 E4mFcTob1QWS0uCafnSa3/o4vYOvc52Mzg0P3j9ou7yM4T6jpUz7HSwGvEtTczTysPDf0AGByC ug0= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 16:01:02 -0700 IronPort-SDR: j8R4hwjWkI89TAjE//f7yaM8e9X271TNglp35Fq+E8Il9DS8I/NHA9yGyZpdM//1ytQESR4L99 Rbwz6Uvc8kngTJcPVMo0dPL/cJxPPKTeDrCRBzaxGf5h/n/TP9heI8tHaVk4y0e6VR1hZxJ81d j4ESnJJNHKo0fOAOsgpGG9GbUl2fuYD7XtbhkvWjUWv4mWo+ZV1Rx8lvwPosTBJ5rwQDCZmfh1 /Upw4zRv85OaoOAsgiCSbTckea3yHyYlHwPpJmbqAGO/kHDPeCS8Bax4gkuXTNxiO4qJzNxhUc u5g= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 16:44:54 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4Pn37S6rnsz1RtVt for ; Wed, 29 Mar 2023 16:44:52 -0700 (PDT) X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1kcA2K5CZsIM for ; Wed, 29 Mar 2023 16:44:52 -0700 (PDT) Received: from [10.225.163.116] (unknown [10.225.163.116]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Pn37P0nXXz1RtVm; Wed, 29 Mar 2023 16:44:48 -0700 (PDT) Message-ID: <7441afa8-3e60-79cf-66c7-4ddb692c1bcd@opensource.wdc.com> Date: Thu, 30 Mar 2023 08:44:47 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 To: Johannes Thumshirn , Jens Axboe References: From: Damien Le Moal Organization: Western Digital Research In-Reply-To: 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.9 Subject: Re: [dm-devel] [PATCH 17/19] md: raid1: check if adding pages to resync bio fails 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-raid@vger.kernel.org, jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Chaitanya Kulkarni , Andreas Gruenbacher , Song Liu , Dave Kleikamp , Mike Snitzer , Matthew Wilcox , Ming Lei , linux-block@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, David Sterba , linux-fsdevel@vger.kernel.org, Christoph Hellwig , linux-btrfs@vger.kernel.org, Bob Peterson Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: opensource.wdc.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 3/30/23 02:06, Johannes Thumshirn wrote: > Check if adding pages to resync bio fails and if bail out. > > As the comment above suggests this cannot happen, WARN if it actually > happens. > > This way we can mark bio_add_pages as __must_check. > > Signed-off-by: Johannes Thumshirn > --- > drivers/md/raid1-10.c | 7 ++++++- > drivers/md/raid10.c | 12 ++++++++++-- > 2 files changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c > index e61f6cad4e08..c21b6c168751 100644 > --- a/drivers/md/raid1-10.c > +++ b/drivers/md/raid1-10.c > @@ -105,7 +105,12 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, > * won't fail because the vec table is big > * enough to hold all these pages > */ > - bio_add_page(bio, page, len, 0); > + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { Not sure we really need the WARN_ON here... Nevertheless, Reviewed-by: Damien Le Moal > + bio->bi_status = BLK_STS_RESOURCE; > + bio_endio(bio); > + return; > + } > + > size -= len; > } while (idx++ < RESYNC_PAGES && size > 0); > } > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index 6c66357f92f5..5682dba52fd3 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -3808,7 +3808,11 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, > * won't fail because the vec table is big enough > * to hold all these pages > */ > - bio_add_page(bio, page, len, 0); > + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { > + bio->bi_status = BLK_STS_RESOURCE; > + bio_endio(bio); > + goto giveup; > + } > } > nr_sectors += len>>9; > sector_nr += len>>9; > @@ -4989,7 +4993,11 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, > * won't fail because the vec table is big enough > * to hold all these pages > */ > - bio_add_page(bio, page, len, 0); > + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { > + bio->bi_status = BLK_STS_RESOURCE; > + bio_endio(bio); > + return sectors_done; /* XXX: is this correct? */ > + } > } > sector_nr += len >> 9; > nr_sectors += len >> 9; -- Damien Le Moal Western Digital Research -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel