Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2651099imj; Mon, 11 Feb 2019 06:29:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IYkpdfhQsOc0aycHGcQliBLIOkvPcwgaZaHrz/2WGiIvdqVmSz01wQr0andI1NziZ8fCBpe X-Received: by 2002:a17:902:6948:: with SMTP id k8mr37362768plt.2.1549895361198; Mon, 11 Feb 2019 06:29:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895361; cv=none; d=google.com; s=arc-20160816; b=IBD0kTVPqG7ReVUyNlz0qZxXNTqVoJaRT9vkuBXS2E/g/uG6MaMk9gcmIWw2axNVNf n152mtOyJV46f081lNi8czP1V8OkGIqCOU+q3rZjAB+e82UzkV287urFZ8BGcg8Jfbne CxyZGWujRspV1ypLL0GHGGvg3962rR06qZIcnZHxgxzNH+cwhzjdPsRXaMPSIuTMGecq JJU17QyOF4yDot/ehFwMHKEKV8U86QU6mH+R0IlO5qUDLQTXPRhGyanXJYJUXsQOOMQv K2t1+lacfBO7Do7f3IymeJ95egapFF72pu4CBuC0NONCgM6vbGWsZk4byCQeJCqRquAw Y15Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e5ewtynKCIyZQTjFl6tg8bVOCL+hkcS3OelT78UusMs=; b=WVyLRwB3o/CgxjbLAhxMApXAs+JZBxNg/cGz6fu+hJokMBLkikbP7BKsf+aOb4Apnf 9m/3n+XPJsjqBF1JzWhIRgLDnLRV92/0Huq59AUmScH8+7KCO35Ma+Dt5IK+vD7JrLET 6qf3mPJlhrCCs0pqi41OHAJjmG9t8OEuJebN4yNxzbPEzpdroSAM9sqjknDG1lwWgQ96 6lGFdsbSZvHYkYaGvnLS4TxhsOuuwASwKYVVARpLPIRGzJYz7Cvkehq9DaLHrkNTyakC xcL3unR+xxODO4d3nfj0XiS2S91xqxlk+Je7BrwUjbtCIeS7b3sRGXI2mb97BPvj3xt3 XaCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ip9DhEh2; 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 e192si10089337pfc.28.2019.02.11.06.29.05; Mon, 11 Feb 2019 06:29:21 -0800 (PST) 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=@kernel.org header.s=default header.b=ip9DhEh2; 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 S1729791AbfBKO2C (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:33854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfBKO17 (ORCPT ); Mon, 11 Feb 2019 09:27:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3B8620821; Mon, 11 Feb 2019 14:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895278; bh=Kjlp6ny6c9L9TO9jcrPSypehK0rhxDrSZ+fY6GGw9xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ip9DhEh2AKzXql1TGNlx874hUcXwscdxQEozy7MSEo1LVO5j1PnM1YKpeEiXAUo9Y epnIyf1x1PS3FQ1qfHP3IYG+ze6HqBePXTeHtHzyDFq9b01HS08EJQubyVnKT7fu1N jeqUVJOyb+c59IFMBQfM916pe0eU4bJJcy9ZRu4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Holmberg , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= , Jens Axboe , Sasha Levin Subject: [PATCH 4.20 153/352] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Mon, 11 Feb 2019 15:16:20 +0100 Message-Id: <20190211141856.452423797@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit c12fa401ac8c94a74aff68bb5736b3f1dc695fa8 ] Make sure we only look up valid lba addresses on the resubmission path. If an lba is invalidated in the write buffer, that sector will be submitted to disk (as it is already mapped to a ppa), and that write might fail, resulting in a crash when trying to look up the lba in the mapping table (as the lba is marked as invalid). Signed-off-by: Hans Holmberg Reviewed-by: Javier González Signed-off-by: Matias Bjørling Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/lightnvm/pblk-write.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index fa8726493b39..3ddd16f47106 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -148,9 +148,11 @@ static void pblk_prepare_resubmit(struct pblk *pblk, unsigned int sentry, w_ctx = &entry->w_ctx; /* Check if the lba has been overwritten */ - ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); - if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) - w_ctx->lba = ADDR_EMPTY; + if (w_ctx->lba != ADDR_EMPTY) { + ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); + if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) + w_ctx->lba = ADDR_EMPTY; + } /* Mark up the entry as submittable again */ flags = READ_ONCE(w_ctx->flags); -- 2.19.1