Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp34347pja; Fri, 22 Nov 2019 03:06:27 -0800 (PST) X-Google-Smtp-Source: APXvYqxJ523cuDQunv3Z53ajPNUL5hPFgecVeQ4DCPvXBt0q8hlGslupxwQiNgExXKaPh0QQZZE+ X-Received: by 2002:aa7:d1c9:: with SMTP id g9mr314297edp.162.1574420785014; Fri, 22 Nov 2019 03:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420785; cv=none; d=google.com; s=arc-20160816; b=wVOpyqnJgO7nwRWY9aEumo+fhdqwGTCfKc91QZcN3vC+C/VZebWNH3Wbccq9Asb+fj fTsuyDNdvAO+l3RS2R62scCOvk2wVw/EHuNlC9MB0ptzLVRPe6qaKYNgrseJGmjXl1Hb uubj+WccRA/y2KAS7BCTRInz0G7t5z1yP5xwR8itT0ua+whu36Lv1F2iBrDKIur9LpxH XQEarVjyQgSUKx10Lcokhqzj6fY+Go09Voay3FIOP603W33LNu8+EIeIp2I4LtAmsE2H u5C79Ka+ZOks/KhwXA1/1h9brwvQJOrD/MAVHMZcptbs7PQJTjRK/oC565Nxno0Pr+lW uPoQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AIZNpJLO5n3xbm8jKYVzxToRXftlZsh9EzCGYmFQLWM=; b=SuyKNTmBSr67NA9ZVGDqUWYVFgAXFTdlFDvMWNdMuT6gqg9QnZTpj/+BYywjWFezHm QX6Kot31XcnwFtbImQuitFt4YAf7XBgLfZbZGwhVRNf+C/F0EQpSFKUryIoxCtEGalcf ieUgMNbV1pZOUh44+27l8+5Xack2O06vr2NzlGJ1Y0DypZS6FgAfxdWe/6HJuIqMFRb+ CU0U4UodyaSePMhuvaHJmhtGGIC26tJARg9PEF9DCY33Z1h2WfI5v/L3v4cxh+OXvTCe 5H2vAA449SHX9DJgxfN2oZKRtACZ7kYfE+r2l8PxHwpvn8qAC96EXLYhafSiK6gmqRJG laoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ooKUYFlt; 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 ca10si4370065edb.67.2019.11.22.03.06.01; Fri, 22 Nov 2019 03:06:25 -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=@kernel.org header.s=default header.b=ooKUYFlt; 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 S1731209AbfKVLEN (ORCPT + 99 others); Fri, 22 Nov 2019 06:04:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:58762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728091AbfKVLEH (ORCPT ); Fri, 22 Nov 2019 06:04:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C11B20659; Fri, 22 Nov 2019 11:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420646; bh=7gw2hzPD+NzEGUoM3K2TyQAxcHH4cIB6feJwbfAhmAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooKUYFlt2+NJ/kHoP9YolDACVHdKCR4XbWXFxV/3miRkhLA+qbjPgIEx38qYM/UeC 5wUfJ62nLAHHJwsyzIyOv9g/UWr43jv35mDiSQBHenB3Svko+fuIjCrO7xUUPSeyzd d5ZT3HrsLtp5qxpx1uJcIq9MVojyK223HzAL8Imk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Matias=20Bj=C3=B8rling?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , Hans Holmberg , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 179/220] lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync Date: Fri, 22 Nov 2019 11:29:04 +0100 Message-Id: <20191122100926.291925470@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matias Bjørling [ Upstream commit 4b5d56edb8fc565c5db029aecaea598eadfba7f6 ] 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ørling Reviewed-by: Javier González Reviewed-by: Hans Holmberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 80710c62ac293..fd322565fb0f9 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -893,10 +893,8 @@ static void pblk_setup_e_rq(struct pblk *pblk, struct nvm_rq *rqd, static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) { - struct nvm_rq rqd; - int ret = 0; - - memset(&rqd, 0, sizeof(struct nvm_rq)); + struct nvm_rq rqd = {NULL}; + int ret; pblk_setup_e_rq(pblk, &rqd, ppa); @@ -904,19 +902,6 @@ static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) * with writes. Thus, there is no need to take the LUN semaphore. */ ret = pblk_submit_io_sync(pblk, &rqd); - if (ret) { - struct nvm_tgt_dev *dev = pblk->dev; - struct nvm_geo *geo = &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 = ret; - goto out; - } - -out: rqd.private = pblk; __pblk_end_io_erase(pblk, &rqd); -- 2.20.1