From patchwork Sat Nov 11 23:59:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10054571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24AC96057F for ; Sun, 12 Nov 2017 00:07:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15E4229AFB for ; Sun, 12 Nov 2017 00:07:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0799029B0F; Sun, 12 Nov 2017 00:07:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DBF429B0E for ; Sun, 12 Nov 2017 00:07:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4BCF920359A88; Sat, 11 Nov 2017 16:03:51 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9231320359A86 for ; Sat, 11 Nov 2017 16:03:50 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2017 16:07:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,380,1505804400"; d="scan'208";a="1296884" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga003.jf.intel.com with ESMTP; 11 Nov 2017 16:07:54 -0800 Subject: [ndctl PATCH] ndctl, create-namespace: clarify autolabel failures and fallback From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 11 Nov 2017 15:59:39 -0800 Message-ID: <151044477986.16188.7243209600918286392.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The autolabel feature tries to enable labels whenever a namespace in a label-less mode region is reconfigured. It builds on the assumption that if the entire capacity is being reconfigured then the operation can try to assume exclusive ownership of all the DIMMs in that region. However, if a given DIMM is a member of multiple regions then the reconfiguration operation cannot assume that ownership. We detect that case by checking if the DIMM in regionX is still active in regionY after disabling regionX. In that case we fail the autolabel, but we should not fail the namespace reconfiguration. Provide debug messages to indicate why the auto-label failed, but then try to continue the namespace reconfiguration in label-less mode. Signed-off-by: Dan Williams --- ndctl/namespace.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 077d5968d0e8..b780924ecf4c 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -901,8 +901,10 @@ static int enable_labels(struct ndctl_region *region) count = 0; ndctl_dimm_foreach_in_region(region, dimm) if (ndctl_dimm_is_active(dimm)) { + warning("%s is active in %s, failing autolabel\n", + ndctl_dimm_get_devname(dimm), + ndctl_region_get_devname(region)); count++; - break; } /* some of the dimms belong to multiple regions?? */ @@ -945,7 +947,7 @@ out: if (ndctl_region_get_nstype(region) != ND_DEVICE_NAMESPACE_PMEM) { debug("%s: failed to initialize labels\n", ndctl_region_get_devname(region)); - return -ENXIO; + return -EBUSY; } return 0; @@ -968,9 +970,8 @@ static int namespace_reconfig(struct ndctl_region *region, /* check if we can enable labels on this region */ if (ndctl_region_get_nstype(region) == ND_DEVICE_NAMESPACE_IO && p.autolabel) { - rc = enable_labels(region); - if (rc) - return rc; + /* if this fails, try to continue label-less */ + enable_labels(region); } ndns = region_get_namespace(region);