Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp681255imu; Mon, 5 Nov 2018 07:14:24 -0800 (PST) X-Google-Smtp-Source: AJdET5eAyM+msMXK5JRhPIYNJRKPwayPctjlrRH6u0M553O2IQvOpgAbCdi9hKT6FZ/aJkaaPakf X-Received: by 2002:a17:902:9004:: with SMTP id a4-v6mr22319878plp.334.1541430863946; Mon, 05 Nov 2018 07:14:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541430863; cv=none; d=google.com; s=arc-20160816; b=Y/v6T8An6D6fTi8P96ht+llXdu0A2tp/Qx6Gzuiw2jjsq1ZHDhUCuHq1U2+XtXHTsY IckHriVV/j4RSJt8jywUGVSe6wfN8vOiK5JuE9FBKog+7CP8OLujW+dkk5NCkhS7A7fE n3DRsHjuc7pClXVukfe6ss8fxVVdpw8PKNzeESl7k56/kpnoc6o+5I/bK3u3ZLXN0mbd z6DkRuRqKJqkd1r38nmnkdD2rMY4rVYguwNI/sR1UlNeMjFslmzo1LkqwfKqdyeEAsel gKCycRylyR9WMhMdavOpXo40ujRdpfi2wRhZvCElia1Ozxc+VMKnHqwdLYjTiaC0ep47 KaRg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=dl0r6l6Ef6SeaJHQNvPmzwlCBWuy7OrifEVzdyPNQ9Q=; b=LSIzVcBMjoarJ20Ldw/pDRtJjWIxfjvD/qyfhamW22WKcG94J0aHIBJz4mveHvCs/+ CV5Q7uO97BGtAtxMXMCYMQrhGedDgk5eKmHQH+r6PEl4WL3gqLrAo6+eKVde77Gd9eCk 6TwGxPO5nfhwxBjwpNu681mUsWl0BCHiEr7qxvG/MaMvCAlrH3d41OLMzZJz0IUO1c59 L7Q9Q+NcxPf4buApuJ7M3+JIEd7HqnciOH1bA5sai4el5dMOKfiFdoTP4AGXVXkZETYl TWD6+kdcXGP6//v16fcHRfu4Jzy9KBPGiBXOlkGGcBhlQ/Ntf8hMPq3vQArOLfKxhdc0 BTzQ== ARC-Authentication-Results: i=1; mx.google.com; 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 z4-v6si44474458pgj.39.2018.11.05.07.13.48; Mon, 05 Nov 2018 07:14:23 -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; 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 S1729848AbeKFAdD (ORCPT + 99 others); Mon, 5 Nov 2018 19:33:03 -0500 Received: from mail.gydle.com ([64.18.173.180]:51115 "EHLO mail.gydle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729430AbeKFAdD (ORCPT ); Mon, 5 Nov 2018 19:33:03 -0500 X-Received: from [192.168.1.136] (unknown [69.70.179.254]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sboisvert@gydle.com) by mail.gydle.com (Postfix) with ESMTPSA id EA4C64490B; Mon, 5 Nov 2018 10:12:52 -0500 (EST) Subject: Re: [PATCH v2 1/7] lightnvm: pblk: fix resubmission of overwritten write err lbas To: Hans Holmberg , Matias Bjorling Cc: Javier Gonzales , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg References: <20181105122610.1555-1-hans.ml.holmberg@owltronix.com> <20181105122610.1555-2-hans.ml.holmberg@owltronix.com> From: Sebastien Boisvert Openpgp: preference=signencrypt Aut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7/byqqjl1hwkiZeIcajZqK8hws6h6bLLZBn7EcZAEj8VLSdfUjJqCt VOZyQGdo8sNYjJPeV69vNbBUbX7BcxhxRZEYXw1rCz/xaCbNyRqRsxT03haPLg+WVQARAQAB wsFlBBgBCAAPBQJYtEIDAhsMBQkJZgGAAAoJEGsrrSebZ4/x13oP/2gWO3D6zo2Ok13khz4u +blJz8rzV1PQ5TVJmrsU05pVDlKgoZdtfEUtHlfAkzvNUpoKhNRWVN5/3QLwF4z0jfXyFYuS 8CVMRA75h59jSABdCWvZrQLHKJV03t++IFBi3y2DUilHXrCHUxg0iJeUhbMorgxc43d6DJw2 o53r+hBTfexVvcCodOREHR253eaw55lnL1J4sn0KVfprd0tLUTtR6QtF6oMXTcRedrE5bbQB oH/mmorTeQcEO6uDqc9SgqzEaLpNUxsXOBEMp0HYsQBoTdGzsh6aZGrVHX47A3ZLFv9WbRB+ iluFb5KY2n673MOZgSuCFurTuNm+Ik4qfHz3KCVkEghN/swYZW/ONxqZC+2kIPO30WJOnvSL OptwSrxigmRMwJMCYI59NwaF9lyk/F8iL798mNXuhb9mWoiw2Qfjm5xAI+8u3ECDlF6RImKJ QW26frU/JgIUOPrTP+XkxBzCK+vKVekqjhASMH0vLMUBjY02EvqjYfR1egevXc63hMJDR513 uqyECDvmUMJulfMUR2BeaX/+6/alsvQLlvDF8sZ1wrP4PFdqTELwMPHvKsZgX4KhMnNUhPSD XxdTif6ZoOAt/ZdtmdSV6InuwAz/1C9VnBRGP459T4N2OYSql4P4rcGBokrQCFC4kP/ZdqDf vnOzfc5OOiR/D+lE Message-ID: Date: Mon, 5 Nov 2018 10:12:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181105122610.1555-2-hans.ml.holmberg@owltronix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > > /* Mark up the entry as submittable again */ > flags = READ_ONCE(w_ctx->flags); >