Received: by 10.192.165.156 with SMTP id m28csp467242imm; Mon, 16 Apr 2018 03:29:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MQP4un0Orj2sqAXO119oNGOEz0+QYXVywl3GVHhFafsTzurKgKoanZzOq/9psjB4/cDYQ X-Received: by 2002:a17:902:694a:: with SMTP id k10-v6mr14502583plt.161.1523874580198; Mon, 16 Apr 2018 03:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523874580; cv=none; d=google.com; s=arc-20160816; b=kgJLruZUeBWOAZygHEmVDk4en0mifDVe1iYwNDxoGJ5cojhlj5ZTKSCuNPUQX6vEz0 UPaZO8gQla4e4f6QdrIC4RrN2m/9r4x3hRNamVWKv87ZWZhWmbIY97HBvLKLCrj5cU4J wcsNtzuEsuBhRjg4OT9avyeES5TrnrrFazrXXApQQTEbCe5GsWy/VWwv5TUAyw9Tu4fV 8N3B+8+lHhxO1r5Ehg+JX3VrERbxBhWKiABytFCXyvPYaF6b6OazUKJG2YO46XidfI1c AANJUmWSHmpsUH1t6e/SZT9OHB2i8LXEdOKSNpJsmlW9yTO58Ea6TmIs5HxaXGU05+Uc E/5g== 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=PWACUEUrpxTQQ6hjl+ACqmu0P9+GeVEvSyZyy2QeLR8=; b=EkA7P8HGZscLaPg4ILz26gw02OUOZ46d/KnfoaX58hxgQTqml708v4Fiz4Md2Lp48F AP8io7xMU7si6BC9uW5/wCEGj7ErPxI8k8zIZ2s0LsZdXOBA547uYvAige3soKGWB+M6 DhNFl/qFLAwdr5q+doSOAykh0RLNHpvpiV+4tJs2tJ9ZBZRgsUpPaK/8x2zRW3q4d+jW aINl/ZUGfzLwUz3LIgUJ0ZkWf/FJKRst9KfT5Kllwo8Llq50HqXEUAKtzfseTGuXWL6V 2hbtxh/9yHcY6Q68nF9Lxv3meu0QQss1b0AxpOsN9W82QYLtHLl+vSA/Q26IhzfYGXcd 8Tfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=PyoYgAEh; 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 o2si9414579pgq.451.2018.04.16.03.29.26; Mon, 16 Apr 2018 03:29:40 -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=PyoYgAEh; 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 S1754813AbeDPK1y (ORCPT + 99 others); Mon, 16 Apr 2018 06:27:54 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40827 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753690AbeDPKZp (ORCPT ); Mon, 16 Apr 2018 06:25:45 -0400 Received: by mail-wr0-f196.google.com with SMTP id v60so20539681wrc.7 for ; Mon, 16 Apr 2018 03:25:44 -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=PWACUEUrpxTQQ6hjl+ACqmu0P9+GeVEvSyZyy2QeLR8=; b=PyoYgAEh2KQOzHfNyqgnO6Imo4udFfyenMXAA2Qbgxgm0+I9Ehe3dRXjmJW5SPJJVs 58HxCSwgx6EOAqPUFfpQ66K1WgQyowyQehLd5dL/J3F2SwfevnjzRH/WUsmXoJMVqfk0 EGQ8gmyH2Dwu+X/awlScfXr21MMlR+HIpFZPgUIHf1/yEDbgeTVoNpi8yjU1YCaCS+z/ YYYj4iJ+wAgf7v5ymTEr6r1uU6AUsXxDNxqA7atoTHg7C0sOqHUjmRqu40lhVxIh5Jyi uP1zszIuuAwv1NGfDmkitkYI3PYIhaCsisLDCXYCkijF8WrgJH+9wIfSeVSMZy3MLtTY vhlg== 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=PWACUEUrpxTQQ6hjl+ACqmu0P9+GeVEvSyZyy2QeLR8=; b=LxUUszvzBVoplVSYzqvuYUz/Nq/15Llq1V5OMz13Sjg4xtcnQvq5mdDtalQGwO9QBD FLw2S+5qGJ4+YpIv5HX7VluKcZ2ZMOPBitc3JT+YDy9KEODLuDSm/gaeprJjiu0d1Bo5 BfplXZvbnzOEiqLpvz4IZbc7AgDkCycslENc8Z3x3iAM/1Ivs844YTrnaMmUmVrVg37Y x72iJxFa0Emz9YqDARiyrFwdBSmrr3pTl2katmewVSNyrFWfRm78RHf5MHXICWSv/L2h QC530ZrxLMRudT5sluRffJZNXh5x/xd/5mGAAc1c/rwRJ5yqKv+JDjBADO1X/4GF7iEH nH7A== X-Gm-Message-State: ALQs6tAQAVQk9NUAKyJtGMyN2kbM7nYyyIJEZxElEyDcXYSl1PD8kcOa 9iDGwTJDlyq08fBwps6nXwPsdA== X-Received: by 10.80.179.202 with SMTP id t10mr31686524edd.14.1523874344208; Mon, 16 Apr 2018 03:25:44 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id q11sm4250074edj.2.2018.04.16.03.25.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 03:25:43 -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, 16 Apr 2018 12:25:25 +0200 Message-Id: <1523874332-6272-5-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> References: <1523874332-6272-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 0d45d4ffc370..89aed634333a 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 wholes 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