Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1589429pxb; Fri, 27 Aug 2021 12:19:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSxRqyjQhtswNMC/sn+AimF5AZUN39sW+8vuXNd6YZM8Z+zaOYhZLdRQ18X4qxZr2QHFS4 X-Received: by 2002:a92:c68a:: with SMTP id o10mr7596551ilg.163.1630091968543; Fri, 27 Aug 2021 12:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630091968; cv=none; d=google.com; s=arc-20160816; b=vQdD1QzDQr14A2iCv9MVzqO3bfzMqApg1FM401RfJD3FRLVUDRty54iL8h2e9lQ485 kcGisHaZiBna/K8wwKBwRt3cNah55pit4Qvt5MmejpDFPNvcBphqbUFL75KAeCy8YFpm gz24C2siAsOQ8pdm9BRk2klftFtyoEQv/abTSHD05F6TN100HVv+V5a284l/GpE0PfR3 9GKYZRUgxrziSezpyERvWiCKcKfqu5QNWQ8uGWA8dhTv5eMu2bHxeEWzgr10t0mUIkou ODX3v6hwtPGOyz0m92Akt0Y45EoKmrpPw48VklDESzCW3ymg1UFGNO1iEsCzVqqTv9F2 BWuA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GDvHqyDUto9s8kCaWrxjdJXCPD/eZADtXbZwEghTKUI=; b=eOLqOShshi4zTw6n9ErL57PRDPmLZ29j7rb6+YH9jF2cCsAB15PmUU5ITUR7dic8bJ BlhpHEhxH4ypaqFHSL+hEkJs1CwjgzIoIA8Yugbji5+P1KNVxSAjF4C5f7clleLQefI0 KQp2BhEcrefq2aWYjH2zHDmaoxkPhEv/qnZ22xSw2WTj8ISSZJ8U8yO0bbwTdDQvZMFo byorVJYs2YfWMVFcsz3vdZQ93aq/QGGdw1gv688Waj1+TmlCfi+h5H9axrNCgN18xyTR R0eMuovyIh6Nyo72psoc0serN32U20id0atHObD1ZxAh35s5O8NnF8g9ymOdhTrlZbWM 2FHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=S4MU5GCI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si7622519jas.40.2021.08.27.12.19.16; Fri, 27 Aug 2021 12:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=S4MU5GCI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231267AbhH0TTU (ORCPT + 99 others); Fri, 27 Aug 2021 15:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230521AbhH0TTO (ORCPT ); Fri, 27 Aug 2021 15:19:14 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90561C0613D9; Fri, 27 Aug 2021 12:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=GDvHqyDUto9s8kCaWrxjdJXCPD/eZADtXbZwEghTKUI=; b=S4MU5GCIV4+ftrMG4UOyAR+oD8 s6X/ggsp+r3jrjgCJwZH9MmjalcMMVmkGAcukRynTXANDqDc15o8k5EE2KGFpHylTt+j06KAnH4Sk dMmhl8bM6iF6wtGGlcDTYtc68thxiP8k/mcSFCtvgZ/UuAHoyrGuNHC6mtfj5Jt7zpJ4vEIItRDN8 SeAcSeNlfz1yb9+hiXapNbS5nU+7XsMlZdTbTZTD+6L4ehekkEpODwTQjCj6LjJqP6Tr2i2qZntt8 loStFfJSEG7tz2Vot86bYUATs6Qr2LMowWD3tSb5Ip+ugS5qbBzTQqLb/jdhbzlqQp8bDGzCSXS8/ SHg3xDUA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJhMh-00D5Aw-4U; Fri, 27 Aug 2021 19:18:11 +0000 From: Luis Chamberlain To: axboe@kernel.dk, colyli@suse.de, kent.overstreet@gmail.com, kbusch@kernel.org, sagi@grimberg.me, vishal.l.verma@intel.com, dan.j.williams@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, konrad.wilk@oracle.com, roger.pau@citrix.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org Cc: xen-devel@lists.xenproject.org, nvdimm@lists.linux.dev, linux-nvme@lists.infradead.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 03/10] nvme-multipath: add error handling support for add_disk() Date: Fri, 27 Aug 2021 12:18:02 -0700 Message-Id: <20210827191809.3118103-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827191809.3118103-1-mcgrof@kernel.org> References: <20210827191809.3118103-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Since we now can tell for sure when a disk was added, move setting the bit NVME_NSHEAD_DISK_LIVE only when we did add the disk successfully. Nothing to do here as the cleanup is done elsewhere. Signed-off-by: Luis Chamberlain --- drivers/nvme/host/multipath.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 37ce3e8b1db2..f95643629fdb 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -479,13 +479,17 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head) static void nvme_mpath_set_live(struct nvme_ns *ns) { struct nvme_ns_head *head = ns->head; + int rc; if (!head->disk) return; - if (!test_and_set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) { - device_add_disk(&head->subsys->dev, head->disk, - nvme_ns_id_attr_groups); + if (!test_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) { + rc = device_add_disk(&head->subsys->dev, head->disk, + nvme_ns_id_attr_groups); + if (rc) + return; + set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags); nvme_add_ns_head_cdev(head); } -- 2.30.2