Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp739410yba; Sat, 4 May 2019 11:41:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/O88szaAIET6OtPn8x4mHoe+ZlQPDyV2crQ2KOfUENV4iqQFJh9GE8gtEaj7y/311AvJO X-Received: by 2002:a17:902:12f:: with SMTP id 44mr20712918plb.193.1556995277282; Sat, 04 May 2019 11:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556995277; cv=none; d=google.com; s=arc-20160816; b=GFpxSymJu4nXECLWyYxVhtcy5c6BHB3htzVq/ofVDjihnR1GKKjsi6ofY9O/fc1VMR Fvqt7HrSvFUn4t3IanCH12HqiTrfAJUuBG3r0MjQpVd25uQ1FG9HjgCfeJ5NARUJgrvu U9QDauKKm07dOSGF12MfdXtuLeVpHx28FZXUTX2CNWHkyoe5de/pCxpecVyf7NygD3+W ct39Kf6ce4HiFxZrR9DJjFq+c5xe5A/LnJnEcU5CrprChU0YN/R7X1SRzZUSOdfO5sto JZQAz02KABWXViG0sTURJWrkMM8IbA9rGc5KTu+s/cv/HYJxMmggwplhFWL3jvkgB1+L 4xpA== 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; bh=S2vs+JZJ0vcQyBAc8rQKC8KdkrSPMNmEh8jTp9rX7l8=; b=CYRr6/X91L7WphuOUZvlZ0CTfWWVEWauz0sYlqlClK55KPm2O6JapMzxpF96Jy9HUx DCbhVmvdQelNCGa4l6ZRGHmpuZruIrNIxeZzqsx7j9f/Livr95CdenggVmgWtZerQIQF SYKxW4nNEVmtaB0TA7a8jNXtRvAwW46EdLELV3Ntf9TGrUiBj3n9BYkjFHyQVGtQXDFQ f11ldNBrNz2jVN1M+7+C5FIvICZPrKsh8cLvJ9e9VtxyrmemfuaSExk7Nx0kyYDSDobp kfSVe0Uc3F94r1m3BqeRUsw12R4T5FJa+Ru/CPC0ZZESHg6Bl3AQ2kcHRaUy/7viLM2e LXAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=lOnXXGZa; 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 q75si7782721pgq.386.2019.05.04.11.41.02; Sat, 04 May 2019 11:41:17 -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=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=lOnXXGZa; 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 S1727752AbfEDSjg (ORCPT + 99 others); Sat, 4 May 2019 14:39:36 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41157 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727498AbfEDSis (ORCPT ); Sat, 4 May 2019 14:38:48 -0400 Received: by mail-lj1-f194.google.com with SMTP id k8so7841667lja.8 for ; Sat, 04 May 2019 11:38:47 -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=S2vs+JZJ0vcQyBAc8rQKC8KdkrSPMNmEh8jTp9rX7l8=; b=lOnXXGZaeuzqk4g+X1Xa7z0IlVXP5cXmT/z7JUTtEsiTUXcFqoKNmaWuwjcu47AVBI m+nOc5x1HFidIjeSZNszVO2zj/aTrVlcofNbFl5xTVYmYGHf0pUQgfZn1qNerBcCgbsw Xm+Cp2FLN/SLqfBb3oRbFK0CdhRgvN1gz7Kq4eN6rXj+Ons+8TxW2I1ii66GG+WHW3A7 uLl8XzlQ2odK6rTKkAV2SsN4Tv+T8DkMKVIGd6hz/ZYS2g/CbScx2ps4AyxSiwLl+wbA w0Er6gD0/TsEKqLQRyV0YkUOwPTcyjTNDhZV3+oFuLC6qyZKPGLG//nCK/IR9H2MzLlQ kApA== 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=S2vs+JZJ0vcQyBAc8rQKC8KdkrSPMNmEh8jTp9rX7l8=; b=aoKHL6D/vYVLwR1mJlbO1DEXKy77M6MW1PLblRtglcMFuEn7nH5s/8XOmi4QwE9tz/ o/svLklEyXKgzv4OHo3a9aO/TL2J3R6H6fDU4abxGSF261W492hJAjbYb52eY/l+Muo5 pDMx9h5zFP34YkQmamTPk0lPz3k7tpY2eXJjoPWZvMuP+Pm/XmiEpPV7k88B/d9mPfKf rYZGiqyUrq9mTyEnyObKsalLSRCFtjOENydILRcKoF9Qy6DRDvghxy4W/KGn+NhEiN7k Nn1TFYp3aGkckWGyxMihoyZwVHjfXbNmp2S7BxIyjlM6r0fjjAh6uO1jbhmf5Ijp+2ww o/Pw== X-Gm-Message-State: APjAAAUcmLE49yu4YcjLhdZVNkQIkYZoFx7asNE0zcm1lDxC4Ia0o7dS w3XdMwyj3G8NolnUh27WFFot0g== X-Received: by 2002:a2e:3a0a:: with SMTP id h10mr6783737lja.1.1556995126659; Sat, 04 May 2019 11:38:46 -0700 (PDT) Received: from skyninja.webspeed.dk (2-111-91-225-cable.dk.customer.tdc.net. [2.111.91.225]) by smtp.gmail.com with ESMTPSA id q21sm1050260lfa.84.2019.05.04.11.38.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 May 2019 11:38:46 -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, Igor Konopko , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 20/26] lightnvm: pblk: GC error handling Date: Sat, 4 May 2019 20:38:05 +0200 Message-Id: <20190504183811.18725-21-mb@lightnvm.io> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190504183811.18725-1-mb@lightnvm.io> References: <20190504183811.18725-1-mb@lightnvm.io> 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 From: Igor Konopko Currently when there is an IO error (or similar) on GC read path, pblk still move the line, which was currently under GC process to free state. Such a behaviour can lead to silent data mismatch issue. With this patch, the line which was under GC process on which some IO errors occurred, will be putted back to closed state (instead of free state as it was without this patch) and the L2P mapping for such a failed sectors will not be updated. Then in case of any user IOs to such a failed sectors, pblk would be able to return at least real IO error instead of stale data as it is right now. Signed-off-by: Igor Konopko Reviewed-by: Javier González Reviewed-by: Hans Holmberg Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 8 ++++++++ drivers/lightnvm/pblk-gc.c | 5 ++--- drivers/lightnvm/pblk-read.c | 1 - drivers/lightnvm/pblk.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 38e26fe23138..73be3a0311ff 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -1703,6 +1703,14 @@ static void __pblk_line_put(struct pblk *pblk, struct pblk_line *line) spin_lock(&line->lock); WARN_ON(line->state != PBLK_LINESTATE_GC); + if (line->w_err_gc->has_gc_err) { + spin_unlock(&line->lock); + pblk_err(pblk, "line %d had errors during GC\n", line->id); + pblk_put_line_back(pblk, line); + line->w_err_gc->has_gc_err = 0; + return; + } + line->state = PBLK_LINESTATE_FREE; trace_pblk_line_state(pblk_disk_name(pblk), line->id, line->state); diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c index e23b1923b773..63ee205b41c4 100644 --- a/drivers/lightnvm/pblk-gc.c +++ b/drivers/lightnvm/pblk-gc.c @@ -59,7 +59,7 @@ static void pblk_gc_writer_kick(struct pblk_gc *gc) wake_up_process(gc->gc_writer_ts); } -static void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line) +void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line) { struct pblk_line_mgmt *l_mg = &pblk->l_mg; struct list_head *move_list; @@ -98,8 +98,7 @@ static void pblk_gc_line_ws(struct work_struct *work) /* Read from GC victim block */ ret = pblk_submit_read_gc(pblk, gc_rq); if (ret) { - pblk_err(pblk, "failed GC read in line:%d (err:%d)\n", - line->id, ret); + line->w_err_gc->has_gc_err = 1; goto out; } diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 7b7a04a80d67..27f8a76d8bd8 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -641,7 +641,6 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq) if (pblk_submit_io_sync(pblk, &rqd)) { ret = -EIO; - pblk_err(pblk, "GC read request failed\n"); goto err_free_bio; } diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 90c703d3f84c..e304754aaa3c 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -437,6 +437,7 @@ struct pblk_smeta { struct pblk_w_err_gc { int has_write_err; + int has_gc_err; __le64 *lba_list; }; @@ -917,6 +918,7 @@ void pblk_gc_free_full_lines(struct pblk *pblk); void pblk_gc_sysfs_state_show(struct pblk *pblk, int *gc_enabled, int *gc_active); int pblk_gc_sysfs_force(struct pblk *pblk, int force); +void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line); /* * pblk rate limiter -- 2.19.1