Received: by 10.192.165.148 with SMTP id m20csp3556096imm; Mon, 30 Apr 2018 02:14:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrBFBt8kz6SD6qSgsn00/dkZj6EmhAHiTIBiKgYgEDByp7ew7fTYVQcHWxNuE+eDtx69rTR X-Received: by 2002:a63:2787:: with SMTP id n129-v6mr9501993pgn.167.1525079651255; Mon, 30 Apr 2018 02:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525079651; cv=none; d=google.com; s=arc-20160816; b=kWfvT3W6HuJD1Ly3gdVJhYDyPNLpfq2+1qDb1mWfDnAGs3zRLcfteX6Svk5OQ9o3mT p2DRuwrgrn1Xf43ImCSReRgx4kUMafQ4tJr923psdiuQM782fy805BE7/ND9zBgJWfMT Dnai4ojucgoLb4+StT2SqUafB37oOHHXSkHPlR3lMJThNb3Ak6mhlDtKwCjvjeOHm3q9 gZdw1U7ZlOMDN0JBkcGhQCezCVlKbL5mYwy198T6ZLdJiVEDqzz+MxQ5ztIIcXp5XUtn 8KRjxo6+hTWMLCCfl5DgpzTVJ4QM2MNq0cJKLStCbZOzZsndv9VSn+oEwkpXQfwFEn2+ IDxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=8Z1gTRMq9LZlB+zFug3nAwykhqlq6531e31M3SCrQA4=; b=Pp+BBJyVBYTHhodNlxp+CKHPYrqAsvSiHemzp6Sk1FGlGigz1/e9ObWOFDYmYN/Vzy 5i9q6h+oK1KaegfxuE7QOKua6AYlJAozQkxiScgeaXaLgInirxvOWQrRQrjg843qkzzV 8NUTwE+K9r1UHWFlf6hvPbCt4uO16Jk/Gb319TO5s6wI/IRaCbDllIVZhZ/0jA8vSx/u 6F75Tk8heItu2DzP6mZu1U5SJp2+vpoCT4CiDfIoXIgoqjtH0kUd8AHicAtn/oy64xkB 67jHJ+EPl2auUxvBgREbPSr4PzMuD6q+AipqgD6Qt75ZQLhg7mAFKPFHJMnKxALoKaae JxTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=2DszXr4y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si7021323pfx.216.2018.04.30.02.13.57; Mon, 30 Apr 2018 02:14:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=2DszXr4y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753746AbeD3JNN (ORCPT + 99 others); Mon, 30 Apr 2018 05:13:13 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34329 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbeD3JKV (ORCPT ); Mon, 30 Apr 2018 05:10:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id a137so9303424wme.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=Mma4IBwuhZ993YKMm+lCxx2qCk1wXss4gKhzI6CgQovC05hOeSwZPZBecifIYmy8yC 3Pmsu+tWqBLMze1Adqj0QMkuzPaqDlYCXDdlalONUk8Km4NbKLqTHuUlteLJ93qdKHCj fE6KaOPZnsMLdQcVJ+IZBfJNQPbcZ/rgafe0yxMx1lkl7Fqt3JiqsbhB/nD8itPGEyaq 0nC8CoKJJxly3zAwgiFCQx3z/A8p6C+ZaeyNjDRPbRYb7b0wYNEbRX8lutmXE+6uy24g +xfndRjmXhFwLW8bamXvkhOTguZ7UNoLI6s5uYJXehlaFOdT6OxtVPl31D82b07vTwLf aQSg== X-Gm-Message-State: ALQs6tAPR6z6p/RfpjF2uTXzIdrOk0Y5uWMaTmlOyNc/Yw2JuZe152OV aCohBKrvM+Qur4U4/dPAGKjqoQ== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.7.4