Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp499126imu; Mon, 5 Nov 2018 04:30:08 -0800 (PST) X-Google-Smtp-Source: AJdET5eaWzmKzgrxJkCenNal67gXTucGGEvTZ9IWyBzwN8Ptoy9CBwOAdNlPmb+MYl5sHRk/Vu8t X-Received: by 2002:a62:1954:: with SMTP id 81-v6mr21845145pfz.237.1541421008209; Mon, 05 Nov 2018 04:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541421008; cv=none; d=google.com; s=arc-20160816; b=qfTADedPMUS82mcmp1vTYwGFQmDCMnTbYBgCYT0/5DkbfOQLRjH4vWUjgiYbMHrdGl esaox60YQlzkpdVSoNXktq6XwP8rc2rv8tU6iWBrU4d/nMI1p/QPFsj8Anzqr5rsQzXI TpOt6Ah/nkfoW6AhtDzNWNK1NsUdKW1ES7HMzn1twvJrsw96sNp91HMUlc5mpxkBA38a 0CBHk/u51kDqUdYgGOj8jVSqgJ+4dh9bQwWn3wkjgQEg3RlccjemdN8ngWaEMcbgxDrw lPWK5LWreHIvABLTlF/pXO2RrOuSd7x+3CsA5tXRYZzC3gdZ3B071zfTahQTc9H1sSGV JJkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=aYpv+KMDP/i822XuAPfSWo4UcCeaEVbMte2++xZ1ARE=; b=LvXUT+XuSqEVYnrQdXNGCAf/V4NqvKxN25+/c2HK+Oivp51KuKM+p46/f31QDx3IcV /ZzasadYdB66Ugwnxa1TP524ThMSeyyt3GVySp+FX7Rh0MWcEzFKWreaVVl2saMu6wTY QP9KjIAcY6SSa6LkczcNUXSrRvExT4MnxKmz1EvPNjOZHvBquk/Ij5t2MN/qWPOa0otd MqAIl8OAXQvb+pXktgd5uDkVFVpQ5uB6wiXv8JLV9vM78oNrz2WZG1roUMINaka3VHT7 Wn7ZRqFacR2plX8MQxIP/XZuSMp23BeU1pGsFREldtnK/2liNXWX9bVOtEBYMak2k9kL V5xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b="p/isB/ZH"; 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 l36-v6si45011547plg.289.2018.11.05.04.29.51; Mon, 05 Nov 2018 04:30:08 -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=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b="p/isB/ZH"; 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 S1729598AbeKEVqR (ORCPT + 99 others); Mon, 5 Nov 2018 16:46:17 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35150 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728961AbeKEVqP (ORCPT ); Mon, 5 Nov 2018 16:46:15 -0500 Received: by mail-ed1-f66.google.com with SMTP id d6-v6so7323599edi.2 for ; Mon, 05 Nov 2018 04:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aYpv+KMDP/i822XuAPfSWo4UcCeaEVbMte2++xZ1ARE=; b=p/isB/ZHmM9OQxSnxxS1ej9Mp6k0hjsDL/Tud1uZ9nyX8JMCUZpm/vXugixU0PMXTi DbHFlGQO4/MNFp6T1+OvYojsslJKZoSpBCm9y3Z0etdGlYesWL029b19ooeAyJw7WGKt TkSH7GXo023B4WxdaxqhO2+QLTPNqEoBlLn/MUVkUTpZxRP+qMnKETsfDLT+6WJgFTRa Khvou/FQFvwBG/h1CPoPkPlJW8SjAIwms0JhDZ8LwwvKA/hvJ60seth0TRjgavVLrnw+ driQEnCo/zJlUlg7OjT5rMiMvsueJ1fs95TKSbhhenuWpu6/D8rqKM1dSOQPcc9ON71A ccVQ== 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; bh=aYpv+KMDP/i822XuAPfSWo4UcCeaEVbMte2++xZ1ARE=; b=gs6Q4AOzFiB7c3brgyDovYh3hNPynxnHT3MzkZherZzoWQ27Qs942hmAZY+N98SxiV HCZ3XNxi1DM9mmAiuuoHTp+nvj6nDrERfHrmyYua/o6qsajWDomlXf9Dwx9gAznOC9Oo f2UJi2QVKck0XmmbN8KtcjTsbl60wAWKo3pUXHvEY1lpPzdIO7+DlcpqTFPaFrs5SyCI ELtA394HltJZVMV7PqMeZIigTK1IGh7RKm3CY6abYjs54fnjH92tmSWDE5pxfEPpvWKX OK7ZOkpuCASqR0JXNM9KaiJT2Kp3KxjiW4wzxnK23a5Xm7j3bjnWS7X1solATlteAuoe fctA== X-Gm-Message-State: AGRZ1gK4MYpacY8gDvin/tybJYSlOyP9Dee90ITYeA7nIFkIbIJGcUwV odUJUKVXtzE3O4ZGAkrdOXCdgw== X-Received: by 2002:a17:906:c7c9:: with SMTP id dc9-v6mr13584726ejb.232.1541420803901; Mon, 05 Nov 2018 04:26:43 -0800 (PST) Received: from ch-lap-hans.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id 9-v6sm7046056ejw.46.2018.11.05.04.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 04:26:43 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v2 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Mon, 5 Nov 2018 13:26:04 +0100 Message-Id: <20181105122610.1555-2-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> References: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Holmberg 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 --- 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.17.1