From patchwork Wed Jun 13 21:23:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 929096 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iXDvlV0V"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 415fwN15Gxz9s01 for ; Thu, 14 Jun 2018 07:27:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=QtD/H6T4ljOmlpWeXp0hdM4XTdG4fK/06fZnxt7tlBo=; b=iXDvlV0VZUPsltbC8tuQ6TagJ+ 6NFnsJh2UW+cAM9CBNM+b2js6B83tojunQrjnF5ad6FU1XugJofC8zPdO6TAGmExwlat6ZlVl6gVN 17k88vWgHE/70+xbAEAdm6YLWbjp0FIzEDFq+/w+U59IRAyDfGppiPSX9KzffvEURw2mM/jsr4NLx jRsepJiubHLFzYAkJhBomGE9IyvWBq3FbHeB9ce731k+7LsV4PWx8rDmmPIdmk7ziH0DC0f1qs2Zf ADiV30677+VYY7Z/tv7u8hjMrFwAzy03ePSG7LxgVDbiXZ+ltbO6KyHuog29zhdzrHrCQoYBAGM9o KhJuoxsw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTDIF-0007oB-CU; Wed, 13 Jun 2018 21:27:03 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTDFi-0004ua-Nu for linux-mtd@lists.infradead.org; Wed, 13 Jun 2018 21:24:35 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 9DEAE18198DC5; Wed, 13 Jun 2018 23:24:06 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [PATCH 10/14] ubi: fastmap: Change a WARN_ON() to ubi_err() Date: Wed, 13 Jun 2018 23:23:40 +0200 Message-Id: <20180613212344.11608-11-richard@nod.at> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180613212344.11608-1-richard@nod.at> References: <20180613212344.11608-1-richard@nod.at> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180613_142426_973270_139CAD46 X-CRM114-Status: GOOD ( 12.77 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This WARN_ON() was used while development of fastmap, now it can be a regular ubi_err(). Signed-off-by: Richard Weinberger --- drivers/mtd/ubi/fastmap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index dabeb01af24a..d5506152c9f7 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -949,14 +949,16 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, ubi_assert(list_empty(&free)); /* - * If fastmap is leaking PEBs (must not happen), raise a - * fat warning and fall back to scanning mode. - * We do this here because in ubi_wl_init() it's too late - * and we cannot fall back to scanning. + * The orginal purpose of this check was detecting fastmap bugs were + * it missed blocks. Now it helps to detect mis-flashed UBIs. + * E.g. when a fastmap enabled UBI is copied to another target with + * different bad blocks. */ - if (WARN_ON(count_fastmap_pebs(ai) != ubi->peb_count - - ai->bad_peb_count - fm->used_blocks)) + if (count_fastmap_pebs(ai) != ubi->peb_count - ai->bad_peb_count - + fm->used_blocks) { + ubi_err(ubi, "number of PEBs referenced by fastmap does not match MTD!"); goto fail_bad; + } return 0;