Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2984891imm; Fri, 10 Aug 2018 01:34:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyk0XDP7IFqJ06KO2RXOX/bXuhlfGll/DsZQwikO9YI3y0UXLh+2efWeNcCUhH83iHZgvLj X-Received: by 2002:a65:6109:: with SMTP id z9-v6mr5490059pgu.243.1533890074704; Fri, 10 Aug 2018 01:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533890074; cv=none; d=google.com; s=arc-20160816; b=A3MDXp2MAkhm4VxGWa7PIzyyUp7qfUZy7mGsEKDm4A7V60i7QkwAtF6jqqFKGqsfnM n0Xo1v850IC+OlfMPBc378UnWmunxo5pF9QzAv0XnOsA0C0rRb5QtPd4A9Rp/+M73Urb FvE718FTwtF5HbfIpJKVL8XCtwKiXeLaXREpcJ6kWsB942i8WL/4lLNRmUiCZSddDGnZ XmTJy71DWM5tUIZFlw5NpBJ4F0bMNEeLsO3nBlc2Qsn8kJ1aVcD+HSA2iIWnto3pyrF8 egTc8SfYol6ik5ypkCDw4Ow4CA4GIHNEnfIo3jYjDjJsAGd+3osO5ckK5QwTDYmuUpOe jCqw== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=+5+vk8TzJLekk5CR7j60VyV+5jkEGyiKn3CZR+45tKo=; b=xPo2OLBDmX87PRzEwcfaFNtckrRLpPv8bJCZa2iJXxMJR4LAXhw/yoYLMp5GYu0Gin 2XOOvawQJYc7FJBIwTdoaIGQ8++crTUV+H5egXVbuk7OPmTT5ZU5kXdTtoGWCB/ZO/d2 eDDN0/oLrF3EmI/Q4F34HfWXDW0I+ns5EtWNOfJT+OgsunrAoHCDhbkjUHY6t/zciDSl 9D+o6cGnnHV70aXUOmRpqiNej0WKo04juKaszNUsz8jy9SPmmoHnxkojlZSdiH1OVsU6 j3AMRYcJhLqrDnSEtOjaxU6dYPj9ZGXmhbSiS86XlY+hOf/+DjZ4+aT/7jFNikm95Fjs I1LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=Pmo1YYHp; 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 g27-v6si10019156pfj.283.2018.08.10.01.34.19; Fri, 10 Aug 2018 01:34:34 -0700 (PDT) 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=Pmo1YYHp; 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 S1727270AbeHJKqb (ORCPT + 99 others); Fri, 10 Aug 2018 06:46:31 -0400 Received: from mail-ua1-f68.google.com ([209.85.222.68]:35921 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbeHJKqb (ORCPT ); Fri, 10 Aug 2018 06:46:31 -0400 Received: by mail-ua1-f68.google.com with SMTP id c12-v6so1022729uan.3 for ; Fri, 10 Aug 2018 01:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+5+vk8TzJLekk5CR7j60VyV+5jkEGyiKn3CZR+45tKo=; b=Pmo1YYHpk+PHLs6C0HDfPs9MNbGbA5uUA6HQFxvKQGzpSL8y4cqEfHdVY9skZJq8Kd ONGPYtEvA3tg9uisHNgAwTIvQJit4G796Ji7rDccUA0+GxfLtRr0/qhzV76+t1kuHxX0 XAEp3ZZHmv2kVsy9N/UVYUvWmKmcvFjMx7eeO6vNQW95Fa1cGs4rIcOTE2lyAXymdnvG geQZUdSdx4ij2IoKwq2UzrmkbY3Rf03lYKIk/EF6OsAfVR8m+sNjIfZViyEN3z3Lq7lN oYNY1dgLp7b4d3XygKJtfg+J1d6ESz4Hd6fvQvWf3aRp481yml76flSTqK3cKduPuFzh tv1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+5+vk8TzJLekk5CR7j60VyV+5jkEGyiKn3CZR+45tKo=; b=nls2NExCfntk/p4bk9Sh9kueA080hYRZbhoFGGWcLrSnroTNfbCqUP2rR4ZBc3gNvE Z+ckPvdTzizVhqVipxxS0r5zaqPfAJK/OyTdVIeGBDACHHUtAW+jVNFdgwvexHOFFJE8 iZY+RPmz4Iwp3/dibGS/cVH+/S7c8DK2j2BmOXyFTFTiA1FrGNHI1nK9bjjcYciNfM1V W/oM/EN4cdBlNYzYOoX+s00O7bsCtCyVDJE9gI0hHcQYD0nfIKm25F9p6oEMBtKSqwa9 ly9GH8H296IhGPhdhvLgQcOj7JdCrmv8XL0JnaiGjndNLAehH2UfkPTP2MLEmzsvb11+ /ZSg== X-Gm-Message-State: AOUpUlHZP9ahkz6fA6pQHuXfHrthbY28Ik86d9q/NNAGb7iMsydoWuOw mqvW1pxyIbVgTuFVMUn3EHeHJZSgP8Z3EUKgm6GRWw== X-Received: by 2002:ab0:72d1:: with SMTP id g17-v6mr3789446uap.33.1533889062117; Fri, 10 Aug 2018 01:17:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:984f:0:0:0:0:0 with HTTP; Fri, 10 Aug 2018 01:17:41 -0700 (PDT) In-Reply-To: <20180802205023.29094-1-mb@lightnvm.io> References: <20180802205023.29094-1-mb@lightnvm.io> From: Hans Holmberg Date: Fri, 10 Aug 2018 10:17:41 +0200 Message-ID: Subject: Re: [PATCH] lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync To: =?UTF-8?Q?Matias_Bj=C3=B8rling?= Cc: igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, Javier Gonzalez , Hans Holmberg , hlitz@ucsc.edu, youngtack.jin@circuitblvd.com, linux-block@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 2, 2018 at 10:50 PM, Matias Bj=C3=B8rling wrot= e: > rqd.error is masked by the return value of pblk_submit_io_sync. > The rqd structure is then passed on to the end_io function, which > assumes that any error should lead to a chunk being marked > offline/bad. Since the pblk_submit_io_sync can fail before the > command is issued to the device, the error value maybe not correspond > to a media failure, leading to chunks being immaturely retired. > > Also, the pblk_blk_erase_sync function prints an error message in case > the erase fails. Since the caller prints an error message by itself, > remove the error message in this function. > > Signed-off-by: Matias Bj=C3=B8rling > --- > drivers/lightnvm/pblk-core.c | 19 ++----------------- > 1 file changed, 2 insertions(+), 17 deletions(-) > > diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c > index 72acf2f6dbd6..814204d22a2e 100644 > --- a/drivers/lightnvm/pblk-core.c > +++ b/drivers/lightnvm/pblk-core.c > @@ -886,10 +886,8 @@ static void pblk_setup_e_rq(struct pblk *pblk, struc= t nvm_rq *rqd, > > static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) > { > - struct nvm_rq rqd; > - int ret =3D 0; > - > - memset(&rqd, 0, sizeof(struct nvm_rq)); > + struct nvm_rq rqd =3D {0}; > + int ret; > > pblk_setup_e_rq(pblk, &rqd, ppa); > > @@ -897,19 +895,6 @@ static int pblk_blk_erase_sync(struct pblk *pblk, st= ruct ppa_addr ppa) > * with writes. Thus, there is no need to take the LUN semaphore. > */ > ret =3D pblk_submit_io_sync(pblk, &rqd); > - if (ret) { > - struct nvm_tgt_dev *dev =3D pblk->dev; > - struct nvm_geo *geo =3D &dev->geo; > - > - pblk_err(pblk, "could not sync erase line:%d,blk:%d\n", > - pblk_ppa_to_line(ppa), > - pblk_ppa_to_pos(geo, ppa)); > - > - rqd.error =3D ret; > - goto out; > - } > - > -out: > rqd.private =3D pblk; > __pblk_end_io_erase(pblk, &rqd); > > -- > 2.11.0 > Nice catch! I just added fixing this exact issue in my own backlog, great that you've already fixed it. Reviewed-by: Hans Holmberg