From patchwork Mon Apr 30 09:10:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 10371185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F38F6032A for ; Mon, 30 Apr 2018 09:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7190C289F8 for ; Mon, 30 Apr 2018 09:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 662BE289FA; Mon, 30 Apr 2018 09:13:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAFD1289F8 for ; Mon, 30 Apr 2018 09:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753255AbeD3JNN (ORCPT ); Mon, 30 Apr 2018 05:13:13 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34328 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672AbeD3JKV (ORCPT ); Mon, 30 Apr 2018 05:10:21 -0400 Received: by mail-wm0-f65.google.com with SMTP id a137so9303423wme.1 for ; Mon, 30 Apr 2018 02:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Z1gTRMq9LZlB+zFug3nAwykhqlq6531e31M3SCrQA4=; b=2DszXr4yk/wmdOA230cBGn2jAqPC1Ma3H5RJf+XGetB7KZnylyJoLr2eSyFzfGktJe OUQ+za/j5M+KOeqgZV5hb0h6Fy/s+kJE7zfKzYx1iUUBT/KhlO48sDrbgs1t8WCx1nDx 4N7Xtv9/XyYnvKd08wz/BoyuOzf5w0QXuWCfNZfbDhcih0UNgpPJif9QTe6/s6U8DcP/ C30M2E1d42M0iM+4QGHdAbFcZ91bLn/WLumrg3jz2/7eOJk4zMnDLtLm2ndDz6qjRVGa RRVV0kXHkLvdDqNwMnpzSGRgb2B9veQgjSP22HW6SjuHQdDFVALic/7YC55ZbYwOtzQp FBcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Z1gTRMq9LZlB+zFug3nAwykhqlq6531e31M3SCrQA4=; b=VpLQvGD5Xgwu3wcMQ4JF6oGFxWdSjz/z62achJlVh/l/BxUubnfMISOH0jvp7xtOx/ IpQjHIQQ3+52SeBioQDJIplpWbvQH/H5Eel5APNFHftaVZEkStP2r8Fe9TYTar7HH3jT ld0laZBhyP+JtzVsbM7dm1NtkiB3dl94ZAiA2LaO3wFItkN6gwxRaZItQ4sBlzVsyPBh /E1g2Iql+jMaAVhePGeMiLsYeeoPfs8wUwFspZDEMUGVnQNRUku6nA5SxLFt6eqbcZSt B/2agedjlXLkfss4kA5/CUpyeE6CkJ/q1Q8BeQJcDGkPst79A+xNhPKUkit1JaWrwiX7 lZyA== X-Gm-Message-State: ALQs6tBF7mwQTWiVdjJ1A7WQJUzJEdDBKjhF3S52UE+QDswzQt2GBiUi Q8Y9YAuArY1gEL74IhFvTlv7fQ== X-Google-Smtp-Source: AB8JxZoOt5xd5OxGqVbq/23s5rqaELLUsoqimucfPWcHLqRQbl797FJxN+WjtPhGWgbzGuZtUsJPBA== X-Received: by 2002:a50:f4b5:: with SMTP id s50-v6mr15535737edm.262.1525079419964; Mon, 30 Apr 2018 02:10:19 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id b56-v6sm2108638edd.85.2018.04.30.02.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Apr 2018 02:10:19 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 04/11] lightnvn: pblk: improve error msg on corrupted LBAs Date: Mon, 30 Apr 2018 11:10:02 +0200 Message-Id: <1525079409-6588-5-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> References: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the event of a mismatch between the read LBA and the metadata pointer reported by the device, improve the error message to be able to detect the offending physical address (PPA) mapped to the corrupted LBA. Signed-off-by: Javier González --- drivers/lightnvm/pblk-read.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 1f699c09e0ea..b201fc486adb 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -113,10 +113,11 @@ static int pblk_submit_read_io(struct pblk *pblk, struct nvm_rq *rqd) return NVM_IO_OK; } -static void pblk_read_check_seq(struct pblk *pblk, void *meta_list, - sector_t blba, int nr_lbas) +static void pblk_read_check_seq(struct pblk *pblk, struct nvm_rq *rqd, + sector_t blba) { - struct pblk_sec_meta *meta_lba_list = meta_list; + struct pblk_sec_meta *meta_lba_list = rqd->meta_list; + int nr_lbas = rqd->nr_ppas; int i; for (i = 0; i < nr_lbas; i++) { @@ -125,17 +126,27 @@ static void pblk_read_check_seq(struct pblk *pblk, void *meta_list, if (lba == ADDR_EMPTY) continue; - WARN(lba != blba + i, "pblk: corrupted read LBA\n"); + if (lba != blba + i) { +#ifdef CONFIG_NVM_DEBUG + struct ppa_addr *p; + + p = (nr_lbas == 1) ? &rqd->ppa_list[i] : &rqd->ppa_addr; + print_ppa(&pblk->dev->geo, p, "seq", i); +#endif + pr_err("pblk: corrupted read LBA (%llu/%llu)\n", + lba, (u64)blba + i); + WARN_ON(1); + } } } /* * There can be holes in the lba list. */ -static void pblk_read_check_rand(struct pblk *pblk, void *meta_list, - u64 *lba_list, int nr_lbas) +static void pblk_read_check_rand(struct pblk *pblk, struct nvm_rq *rqd, + u64 *lba_list, int nr_lbas) { - struct pblk_sec_meta *meta_lba_list = meta_list; + struct pblk_sec_meta *meta_lba_list = rqd->meta_list; int i, j; for (i = 0, j = 0; i < nr_lbas; i++) { @@ -145,14 +156,25 @@ static void pblk_read_check_rand(struct pblk *pblk, void *meta_list, if (lba == ADDR_EMPTY) continue; - meta_lba = le64_to_cpu(meta_lba_list[j++].lba); + meta_lba = le64_to_cpu(meta_lba_list[j].lba); if (lba != meta_lba) { +#ifdef CONFIG_NVM_DEBUG + struct ppa_addr *p; + int nr_ppas = rqd->nr_ppas; + + p = (nr_ppas == 1) ? &rqd->ppa_list[j] : &rqd->ppa_addr; + print_ppa(&pblk->dev->geo, p, "seq", j); +#endif pr_err("pblk: corrupted read LBA (%llu/%llu)\n", lba, meta_lba); WARN_ON(1); } + + j++; } + + WARN_ONCE(j != rqd->nr_ppas, "pblk: corrupted random request\n"); } static void pblk_read_put_rqd_kref(struct pblk *pblk, struct nvm_rq *rqd) @@ -197,7 +219,7 @@ static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd, WARN_ONCE(bio->bi_status, "pblk: corrupted read error\n"); #endif - pblk_read_check_seq(pblk, rqd->meta_list, r_ctx->lba, rqd->nr_ppas); + pblk_read_check_seq(pblk, rqd, r_ctx->lba); bio_put(bio); if (r_ctx->private) @@ -610,7 +632,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq) goto err_free_bio; } - pblk_read_check_rand(pblk, rqd.meta_list, gc_rq->lba_list, rqd.nr_ppas); + pblk_read_check_rand(pblk, &rqd, gc_rq->lba_list, gc_rq->nr_secs); atomic_dec(&pblk->inflight_io);