Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1862208imu; Tue, 6 Nov 2018 05:35:44 -0800 (PST) X-Google-Smtp-Source: AJdET5dGzw7boWaII/T+EjNJS7G3U4eIqo4vXny0SBTlmVoE2IOfI7DhQHDu8eYk8w8MSNIuhpr1 X-Received: by 2002:a17:902:7241:: with SMTP id c1-v6mr20321303pll.143.1541511344120; Tue, 06 Nov 2018 05:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541511344; cv=none; d=google.com; s=arc-20160816; b=I7m1agNggfXiol9Wq54l2UhuYub3qJghSFjr2c0ffPtEQIVT/rK6yrIVmPU0Iu/vO5 4uv/o6vMI9OIdHgHP4W3fmkLv9ZMLEF2PZUYOjeaLue5tZyv02Z7VCdcxFJU0WrVNe7e XncV9vgnb3mYS14A0gNEAa0VSiHS5tpvprGbDoCpr3K1cC6VH/rRG2X2wcbfh6brBwVo aA6hsaHWs2gzvurtAwTCpOBtwAsxc3+gEKntBJqggG4RUS0QtNAANfmiCyK2E0cYNdFK mpQiOyeOzNoXDE3LIj8SjmxZD59mQmz00TAS2CAgtVh153zUKs+nZx72nEJuiYOSn4Xl H4FQ== 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=8hHPwN4g6a4SDExe3kUgDdBPm98FRozlO3nCP6bTp2w=; b=qRTWplbdnAjV+W/dGc4vChru4eVjEc2x4ZPtIZCztNDHkezVvaI1h31rscgDZBvoLt ul8z2zmIggaY/I3SdbNsNOAz1Vek0NcJ8XTWpYTQwpwGd+KL0J+BIv9FouEX7+2Twg3k PysvzeuOgWacG7xfhZ46VYz7jXhntIe7DMFRe7mjuOPtSmmxXDo2Mq3nUQCo9VnkXLfh lu923P78Cu0Ogh+nZCPrFrFZztt2yMO/MmwBdLWiR8ZRVTRHodiFQ4VR5gytB2Ke/4pv Bv8ZfVUPH3lkQCQ7R7pSG55A6Sfu3OkTRrSy2CjbcD6ajh+96eAPNK8RWzL/5qTlGHTn F6FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=AnWiL5xR; 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 u8-v6si6922267pgj.409.2018.11.06.05.35.28; Tue, 06 Nov 2018 05:35:44 -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=AnWiL5xR; 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 S2388326AbeKFW64 (ORCPT + 99 others); Tue, 6 Nov 2018 17:58:56 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:35425 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388111AbeKFW6z (ORCPT ); Tue, 6 Nov 2018 17:58:55 -0500 Received: by mail-it1-f193.google.com with SMTP id v11so11438707itj.0 for ; Tue, 06 Nov 2018 05:33:40 -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=8hHPwN4g6a4SDExe3kUgDdBPm98FRozlO3nCP6bTp2w=; b=AnWiL5xR37/te7QeJB1ltNOvAsU0SgZe+F7ArNF7uPqRfG9OsJ2MGBPP1lJfUZLX4m tTx+L1PennzTEDPoNpkEHbXIPLHExR4wyobaBLZBoI5kgEDNz7br8850flNeZ7icnqFp nAcASjEscgoxS5N3mWaevjaKg4L8sdEjJ5WMX/hkNmXGJfv5ymOBW5w/60z9dkynXpu7 CMihqHwJz8BjfNdGugwCKS6Th1YvsPNIdYFaIZRXfRmJesYH1w9aEYzlw8PcZyst4lUO xBjHfcjohRr6kRL3U12y6dOP8aux79EHeX/POQPthI02ypE9/oBx+ssQNInOuqYPSXHc x2Vg== 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=8hHPwN4g6a4SDExe3kUgDdBPm98FRozlO3nCP6bTp2w=; b=nu1wxL36IeT78ZjAP+/Yra1oanHeb9Kp6h8TNpql7+mi6SkSpTC71c0FDHD+QiY/e1 aCQ9o2NIUnzfL9/vT0aV3FXWM1enRVwY2/kamCrdItCqUN9KHTDklZMfaGBJVEFjQPnN fkgf9iFLXWLlAVwrJXNBAUFmFIppUxdQUhmwsamse9EfbrJqez9JjoZFybwcA0Wij39c 2glkgKnbFy5pdgcEgEVxGPjBNTSKPACvJfl9jUKWKRXqkH5JZTjwZJqtuomw8uUj5uVd LdIBTT41DqnxfWCu/8cH5dVafPcRc/l5laZcvy/6BWrTCnTPlujSmeAyA9nh9h0FfNeb EeMg== X-Gm-Message-State: AGRZ1gJ4qf43t7qnC5RPOAqfJgF5ObMmnttS+sjtWduUZZKO0CJZADjG 5yVU0HwK/ckf022/mn+jB7TvhQ== X-Received: by 2002:a02:22ca:: with SMTP id o193-v6mr22163997jao.83.1541511220442; Tue, 06 Nov 2018 05:33:40 -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 u132-v6sm897282itb.21.2018.11.06.05.33.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:33:39 -0800 (PST) From: Hans Holmberg To: Matias Bjorling Cc: Javier Gonzales , Sebastien Boisvert , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH v3 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas Date: Tue, 6 Nov 2018 14:33:24 +0100 Message-Id: <20181106133330.26570-2-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106133330.26570-1-hans.ml.holmberg@owltronix.com> References: <20181106133330.26570-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