From patchwork Mon Apr 25 19:49:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8931881 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F7EBBF29F for ; Mon, 25 Apr 2016 19:50:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DE942011E for ; Mon, 25 Apr 2016 19:50:46 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 847D9201EF for ; Mon, 25 Apr 2016 19:50:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 79DAD1A1E5B; Mon, 25 Apr 2016 12:50:45 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id D58911A1ED1 for ; Mon, 25 Apr 2016 12:50:43 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Apr 2016 12:50:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,534,1455004800"; d="scan'208";a="939920718" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by orsmga001.jf.intel.com with ESMTP; 25 Apr 2016 12:50:43 -0700 Subject: [ndctl PATCH 1/7] ndctl, create-namespace: report failures due to namespace being mounted From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 25 Apr 2016 12:49:54 -0700 Message-ID: <146161379487.21779.8389169524298318569.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <146161378966.21779.1219526957524644729.stgit@dwillia2-desk3.amr.corp.intel.com> References: <146161378966.21779.1219526957524644729.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.20 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-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case when a filesystem is mounted on a namespace targeted for reconfiguration or destruction, emit a message so the user knows to unmount the filesystem, or otherwise communicate why ndctl could not exclusively open the device for writing. Reported-by: Linda Knippers Signed-off-by: Dan Williams --- builtin-xaction-namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c index 1f25cc18f5a2..97bb36525d7c 100644 --- a/builtin-xaction-namespace.c +++ b/builtin-xaction-namespace.c @@ -553,7 +553,9 @@ static int namespace_destroy(struct ndctl_region *region, * stopping the !bdev case from racing to mount an fs or * re-enabling the namepace. */ - return -EBUSY; + error("%s: %s failed exlusive open: %s\n", + devname, bdev, strerror(errno)); + return -errno; } }