From patchwork Mon May 28 08:58:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10430189 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 2395660249 for ; Mon, 28 May 2018 09:06:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1697F28BE1 for ; Mon, 28 May 2018 09:06:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B87F28B20; Mon, 28 May 2018 09:06:51 +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 6D04D28BE1 for ; Mon, 28 May 2018 09:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753984AbeE1JGg (ORCPT ); Mon, 28 May 2018 05:06:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54143 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754162AbeE1I64 (ORCPT ); Mon, 28 May 2018 04:58:56 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67-v6so30046843wmf.3 for ; Mon, 28 May 2018 01:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RN5moMV+ZbEEFpOtXfFzpcxZRT78lcIqk+wDqgiJwgU=; b=sgl7B6wc3jZ7uOgpaubFe6ihblCFh++tqZOp+heZs5iCr0tcLW1jrhAtfgmxPIbkNu lfoVIyLTFYaAS6XXKjxUM6hIZ28kkzFU5kJH45Do61EMXxhdA4CJFUwa77lfGLVT0fd/ 96vttsrHwfjaXqogsYPRrCZ9S0nuXwVKMSWNGKuOBXUc2rwJmI663p4/m8VfpBP3m3vX kDWdaXKUVCrC1IzfxRMX268frZPCEj53dQeHbHVLPE2Fuh1eRpnjtice7MWSx/dS2T+1 KWOkfkbGe46tryJ0tDGnCi9krgRR7GQpxJZe3gccpITwP8jHA42f3+zR+unxRpU1IG/W JHxQ== 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=RN5moMV+ZbEEFpOtXfFzpcxZRT78lcIqk+wDqgiJwgU=; b=jOrDck4wqxIftfgQp68Ko4vyC7n7cky7zA6dr3TcXwT5MB+ppi/SBO9/xafrbyawnM XZi83vmAYtfaE0FQ7yKZN99H99yuYTjMYvrC95MdWEyOKGtmxL3lAPN45C8lGPOhMQ8h cKcvjbeEy+d7Kxspg2xIRjU1nc5PkCpduvTLn+T4NA4eS6wXCRH9FrCERVuB5V/I/pdr dds1wNPTlBfj2RwmsF5bH6yMFxwnL7XumSBF1GiXopd1lH2jr6aX+8wqhBIFl1HjMzYa cCm1z0kONyKruA+dUV/FpH/CB7hL0QAAZC23PtqW+JRkVrA9xpFsysJ6bGe4H4pKTXq4 iWSg== X-Gm-Message-State: ALKqPwfkpQqsbL83M8aenQSAL7ePFlIvX16dhf1EQRAazu5tz6yf3YUb NJ31nG28mz29BrbaDY+g3KAf4Q== X-Google-Smtp-Source: ADUXVKJY5TY9NTxmi2rrfQWjh6Lk/1ML7/KVdpsqGDu2yd9kzdvzuY0qZbzWr5wN4c60aYmDN1BOow== X-Received: by 2002:a2e:9047:: with SMTP id n7-v6mr7726575ljg.50.1527497934650; Mon, 28 May 2018 01:58:54 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id u2-v6sm5777848lji.4.2018.05.28.01.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 01:58:53 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 04/20] lightnvm: pblk: improve error msg on corrupted LBAs Date: Mon, 28 May 2018 10:58:25 +0200 Message-Id: <20180528085841.26684-5-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180528085841.26684-1-mb@lightnvm.io> References: <20180528085841.26684-1-mb@lightnvm.io> 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 From: Javier González 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 Signed-off-by: Matias Bjørling --- 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);