Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9985238ybi; Wed, 24 Jul 2019 13:33:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSzfTGqpdHnWoA2yuHQasNV5pmJWZpAqGaQGKmi+USOXRuCTZUxdId4z3eNrgssg57XZK7 X-Received: by 2002:a63:778a:: with SMTP id s132mr80499918pgc.242.1564000437407; Wed, 24 Jul 2019 13:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000437; cv=none; d=google.com; s=arc-20160816; b=bWdOEGLwmkKJks00/M4Wv2yAGEDusZ8oPRvKQTTfBzYhHaRqzDqWKCV8ryap+h/Hzg ObxA1c4Lz5E8tcv/Jyv3tnAlQ5NlI4w7gyJK+0gp6oscGX4aS4BfPz73QifzpZukf7ka ej3j7fjV/lOPd4em4HOhXyKrdr6Exk7cijvxbr04Zphr0i4r5kBl4zrGenkyCsbI5Jrx t9Da8C+GFqEieyVm9idIZXihGjRgzxvwDIvGEeyrxlO52v51bePAH9wc3HxSohiJos+i twg6RzucrlUnHZOGtUxQ0Euas9ORNzLFdBUoqGX3rt27qSc4X0b+PcTf7nH7xodiM86Y PhYA== 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=q5mGJulsgL27uFotFZgyfp5C3KTH3OaPU05ukmMSF5A=; b=VuNRMK5EbI8wq/oUUk5MBgpXqTbEnnrN+V95xhMyjEWQVw665f9c4CyuXNhKPmSvEz j0pquXdWQnwItDnS3lx7wvmVmMI66y2IfcaKPtepIHGHmQzC3lrOC+52oOiZhUyKqjvo Xap952Lq7Yxp99m7Aw10xtv3s9iba2jVUnNMYIthxN18DfbRwHdKBdd/f0yD5Ec0bBjA ZXU9vDuBe+89us7/iKDOS4a2GzNXbqJH0PSwFZLkJ7xTf+Iyh6HiL9XwSaJ2V4gFM9dI qttF9xGHayv1I4ub1rGcg18HPIAngm1LflmsUenk53zS8DUH5zIJyRRZdWbWqGikhMl7 /1Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W7HHe5AM; 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 f34si15400227plf.305.2019.07.24.13.33.42; Wed, 24 Jul 2019 13:33:57 -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=@kernel.org header.s=default header.b=W7HHe5AM; 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 S1729300AbfGXT3A (ORCPT + 99 others); Wed, 24 Jul 2019 15:29:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:47704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387658AbfGXT26 (ORCPT ); Wed, 24 Jul 2019 15:28:58 -0400 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 A03D6229FA; Wed, 24 Jul 2019 19:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996537; bh=kiF7LpIZs7E8hkOpmeu+j/x0mZ6sFmbjCc3yKNlnRJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7HHe5AMXL7fWusW600rywxtkepFp/Zs4Hkn2YuJ8nc2zxj5fC4O7xaSoW/cVNBRe JX6JE0cftZQMTsPKDSClrMKNQhhk9JAymhocis8yKHccTWkoQNXADFHBlOcuIoIBvm 3BrLp6C5nUnUVlTlBEPlHFKR15X3nAsEfm/ma01s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minwoo Im , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.2 132/413] nvme-pci: properly report state change failure in nvme_reset_work Date: Wed, 24 Jul 2019 21:17:03 +0200 Message-Id: <20190724191744.482131840@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 [ Upstream commit cee6c269b016ba89c62e34d6bccb103ee2c7de4f ] If the state change to NVME_CTRL_CONNECTING fails, the dmesg is going to be like: [ 293.689160] nvme nvme0: failed to mark controller CONNECTING [ 293.689160] nvme nvme0: Removing after probe failure status: 0 Even it prints the first line to indicate the situation, the second line is not proper because the status is 0 which means normally success of the previous operation. This patch makes it indicate the proper error value when it fails. [ 25.932367] nvme nvme0: failed to mark controller CONNECTING [ 25.932369] nvme nvme0: Removing after probe failure status: -16 This situation is able to be easily reproduced by: root@target:~# rmmod nvme && modprobe nvme && rmmod nvme Signed-off-by: Minwoo Im Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 524d6bd6d095..385ba7a1e23b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2528,6 +2528,7 @@ static void nvme_reset_work(struct work_struct *work) if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { dev_warn(dev->ctrl.device, "failed to mark controller CONNECTING\n"); + result = -EBUSY; goto out; } -- 2.20.1