Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1752449imu; Tue, 6 Nov 2018 03:53:55 -0800 (PST) X-Google-Smtp-Source: AJdET5ecX0ADghZZXfwji9gOe2WW9WyXOj9mno83QXGx92WfVRCLTe2AnT/sJL7BnYP6wDHXmdmH X-Received: by 2002:a62:3647:: with SMTP id d68-v6mr1416311pfa.66.1541505235855; Tue, 06 Nov 2018 03:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541505235; cv=none; d=google.com; s=arc-20160816; b=k1kzgmmaS1M3u836msiR2143RLD3pfs9JjJeZz1ysrdgIpnK4bJ2KSfN2ucS2A/32I +WFdOEM36odPSfzgYm7lFhnrtxHHQxgFINWNw+16teGjd2Q75HE9JKes11YM12OGXJZ/ nUP+Mo74IfuZBtkzc4b+Xz4ECb65+Bnf38jKlYzDMkjee7qWsMgWi4tZoeQJMybL2ljk LzybU7A2Jj3zlA1Y9dGFH/Dk6IQwWTk4y3VpBRtfl6pyMbdEgx7W6xyuNNXDCKDswaNC p3yYslqEzzF58+iG2zUvw5DMQdNuBxihvnywWW61tR1OvWHnQ1HdPQpOnqyO5EhR6UCd 65jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=mcMjyk3T3gFCKmpIOk2YoVt7vuTceNdTcGCCLS+JUXA=; b=Bd61ZNCQdqTEhEMZZbAXhxsil8JP775me/BK2DXj7x3LbpTiz05oiidIBaDIOAhvHi J06CTCHc2yoPyC77ImZqjN2apGvRbFIAgFGfZApGC0xYbasPLrDEPPsk9O0lNC8oE+rw tHWqyLn0peXZuwsvB9aCAScknniQTnFFKf1VfDt3TXqUPNBlMpfE7dJRJMpq5qCXZQJN /SaI//4oYg4VFFXVYdQ1mbHUVeM5lmSg8PjTW6L7KC7E9Uat7KGaq8jA3l5ujrnvG3zS UvJAYc9C7Rgofo6tgZYol8zk8vp76pw0CN6CtFpNv/Z6L0iqCctkT9uErKpNGAfvNKKV j/yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=mRD5ci+O; 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 l12-v6si37904937plc.54.2018.11.06.03.53.40; Tue, 06 Nov 2018 03:53:55 -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=mRD5ci+O; 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 S1730681AbeKFVR1 (ORCPT + 99 others); Tue, 6 Nov 2018 16:17:27 -0500 Received: from mail-vk1-f194.google.com ([209.85.221.194]:39871 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729878AbeKFVR1 (ORCPT ); Tue, 6 Nov 2018 16:17:27 -0500 Received: by mail-vk1-f194.google.com with SMTP id o10-v6so2787813vki.6 for ; Tue, 06 Nov 2018 03:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mcMjyk3T3gFCKmpIOk2YoVt7vuTceNdTcGCCLS+JUXA=; b=mRD5ci+O9LcDW42utOnD76RjVLpDOn/zG+CyfAF49rSv/CqclAnC4IFpikjnrQ2Ln0 P1STD13WbNClBsGy6GjS5tmgMU8F96aH14lSKGuWkQ21t9YpAGiyrHoGjRqUhQTP8B3u ztR1kYAU1bHUYuhX5EDnWnXUVXisrVIzJrpffYW01csP7JoOqxT4JzICyxBGMLuoef8L YpJjWZInBVKmjSscFwXQiAG6mzj6igy/1mJs+OORPFopH6dyPBfvU0nP1yN7Lye3bxoK v9Bzyu3GA5Ez/iIBfu7jvQrcCKB1DhnIJOp8u3DhtmIztYwdcEYUVDSjLB3Op4+2VTOi M9rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mcMjyk3T3gFCKmpIOk2YoVt7vuTceNdTcGCCLS+JUXA=; b=uH0+zY2sGjn3T+WwFLYqGsB34UgEI+M32iJqDCcCsC1BNMZtiVA79PP0TUb1Qlaavz x/M+x9qqrn3XTuKiz0i3dyDYFrvc5xmLCmQjTqBffn2T+1mDbFLzbX6hR4JTnRkoTqtX g20qHgooagbgA+vY+aj5+D8Nx0pSmLFI4/U/hB/lRgdXAX6QOMo9CW9gfXtEMAsbEn3E kKCsYeLdU2P6VkB9SK11rVyvZMsa+5swAQy0gtrNuRQ0KEnPzMepKfGFtQEg2DqOyKqG eE1gG92IzXK8g/9O0AMrbzSNOS/Hr4ceNLrqQ787QX2OclMpc7qQnisDfGU4gATgTs3k UGyg== X-Gm-Message-State: AGRZ1gKB9WMhGAbpAHXzaFQ678Cu7RheqQNGUkg55jWPNwlWB4YrnTI1 leh6416yUgAMPnpDIRPRyWDTUxbKDNjG8Bo5oaOcoA== X-Received: by 2002:a1f:eecf:: with SMTP id m198mr10968002vkh.49.1541505156091; Tue, 06 Nov 2018 03:52:36 -0800 (PST) MIME-Version: 1.0 References: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> <20181105122610.1555-2-hans.ml.holmberg@owltronix.com> In-Reply-To: From: Hans Holmberg Date: Tue, 6 Nov 2018 12:52:25 +0100 Message-ID: Subject: Re: [PATCH v2 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas To: sboisvert@gydle.com Cc: Matias Bjorling , Javier Gonzalez , linux-block@vger.kernel.org, Linux Kernel Mailing List , Hans Holmberg Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 5, 2018 at 4:12 PM Sebastien Boisvert wrote: > > > > On 2018-11-05 7:26 a.m., Hans Holmberg wrote: > > 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 > > submitted to disk(as it is already mapped to a ppa), and that write > ^ > add a space > > > 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; > > + } > > Was w_ctx->lba set to ADDR_EMPTY in the same kernel I/O thread ? > > I wonder if w_ctx->lba could become ADDR_EMPTY after > > if (w_ctx->lba != ADDR_EMPTY) { > > but before > > ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); It can't, the lba adress can only be changed on the write error handling path, and we'll have to resubmit the write before that can happen. Thanks for the review. / Hans > > > > > > /* Mark up the entry as submittable again */ > > flags = READ_ONCE(w_ctx->flags); > >