Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp454596imu; Mon, 5 Nov 2018 03:45:26 -0800 (PST) X-Google-Smtp-Source: AJdET5d4ilIAN98ar83Lq7MPJVYr8NdGU/0AxaxBjQOvFJtQzlB4bPyRSc/t7sixe0JrrU/aPWMD X-Received: by 2002:a62:1896:: with SMTP id 144-v6mr22476924pfy.88.1541418326431; Mon, 05 Nov 2018 03:45:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541418326; cv=none; d=google.com; s=arc-20160816; b=ZG89pZ+pCLNdAUd9kL6xACYsi4ZDtZKvb09wh7Bt2dHAyULEV+zJqo5xuZ1OriSFZI f00HLX05JHWfrPoZlnbFHZydsv5LEpxaDpjDGh1PI7sLWxW6AI6O1qji9Cr0T7/JRB0U 6AsB8I1vTeyH9jUdF9Ie+GeesS69bd+05NpOG+4hQJJ1b6Hw0cjfDRkkRalStuUYO+Zz QJI9+Vk2++oCDnVzsjjqFUyLcUjp3Mv8bB7w7QTitpPeuY2WElcpo2WAPLbnxmmD04Au 0gsXFyq2jHLbWCdzSG2lUZH2g0a5o6TYLdE7VGKTo9vNwZQcGSHNxkGr7mKjQudW1KcI N/Ww== 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=qCw1dkDLslu/HElVaRw3FdhfQGOps1Ieu66UCGRSzO0=; b=bw0k0FI3lbYgOo2uBEyXsPopwM1HnX/lnBAhHcVXO33cIBrLpGVkr9ZbL6tquv5dtI X72oalk+CHMJgg7ydKIR9LbmvDRjxmvE+KaVoHCGERWRrk0w+sL+LqNQzXFYVV4o+eqm WOaShlIRK8iajmRfwVsmugDz1LUoCcZGznjbm9A1qxXww3KH0NVOeK9AI/6sstNRp6vm FsDc5AUvHDMgUzx1qer4cj4ryxInbj8yg5GuEi+ZjtSMbGIgbFqeRRO9dj4r0xCcbiTC UlyROEXuvsXbcmN1w3umeK6afvioO5SrJRTHgCNzqTUqa+dlJWe9Ue/H89Bo6a3MWY8E RX6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=LRcIBwzF; 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 o195-v6si7766185pfg.79.2018.11.05.03.45.11; Mon, 05 Nov 2018 03:45:26 -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=LRcIBwzF; 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 S1729079AbeKEVBZ (ORCPT + 99 others); Mon, 5 Nov 2018 16:01:25 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:40137 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729004AbeKEVBX (ORCPT ); Mon, 5 Nov 2018 16:01:23 -0500 Received: by mail-it1-f196.google.com with SMTP id e11so8805571itl.5 for ; Mon, 05 Nov 2018 03:42:04 -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=qCw1dkDLslu/HElVaRw3FdhfQGOps1Ieu66UCGRSzO0=; b=LRcIBwzF8OGzX4fSBdZBIEU9gtjaLxX7Sw1SJMzHumUcNrq1cVhT4VjANjKBxDNKtV XBaeSIeFLZTZ6D+k/DcEaBU88AqfsrcjTdXyivAbufZeYFIDmK5e9TPapYgnJMoKN34F hSkjfgKyaD7Cks9ZxnQjaG8eLtsteMRV+pTFLw4nvnnitzsyDdE7ui+YVNBnZFpqlL1U TGC6/PgReyRgt5G+sv7GBM+Hy935NReAb08LRrm6PKx26FSZLcRxQN7hP2DNRuRUuGtU gHqbU5a1oTqJ7pHxB8A93D/F2V67+SNO9R4gXED0rNXdBojBa09Y3EJ9TRr+TJ/ivE+w xd/w== 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=qCw1dkDLslu/HElVaRw3FdhfQGOps1Ieu66UCGRSzO0=; b=UoHSGkUGT+S/4yz+f7eBOkh64yeyQ9W0BjPic9hno2uxPVpPa8mdlJy1AOUFhJsP2k GPBPrP3s25I1/zn+aEuv/NByLpfw0w6mgaoAv+10+qyFg6i+isZ9ofefJ99VwFenxTpH GJxJ34ToCef4iWNMM92lQGyx2Vr79uzojwftiqpyLYzNnBXIVxTqlOve2AHowxxThVzh FxhsF7Pzs1YzpTNj/lOoixqeYUb9563qXjYG8hJsCNC29l9zgqyAxLqTPXU4WiAADJxD dHtR4+n9tOPRnYyeg62uhSMx91mqp5MCDw9DHoq9LUB1k984yr1n+6ZGs+hEtO/Lep62 Pp6w== X-Gm-Message-State: AGRZ1gJoUZ8uezu8btsC/ntuptW8wBgMmVf2eFiV7ohtGORySIKOcjWu wabGrH4Wal7ZOqNVvyMWvN3sUza7ZQO/Dg== X-Received: by 2002:a05:660c:606:: with SMTP id i6mr6510208itk.110.1541418123848; Mon, 05 Nov 2018 03:42:03 -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 186-v6sm14880824itf.11.2018.11.05.03.42.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 03:42:03 -0800 (PST) From: Hans Holmberg X-Google-Original-From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Hans Holmberg Subject: [PATCH 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Mon, 5 Nov 2018 12:41:07 +0100 Message-Id: <20181105114113.30932-2-hans.ml.holmberg@cnexlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> References: <20181105114113.30932-1-hans.ml.holmberg@cnexlabs.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Holmberg 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