From patchwork Mon Oct 28 12:47:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 3101951 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7550DBF924 for ; Mon, 28 Oct 2013 12:46:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 653532015D for ; Mon, 28 Oct 2013 12:46:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4079520150 for ; Mon, 28 Oct 2013 12:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756164Ab3J1Mqq (ORCPT ); Mon, 28 Oct 2013 08:46:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41778 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755041Ab3J1Mqp (ORCPT ); Mon, 28 Oct 2013 08:46:45 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9SCkgig005137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Oct 2013 08:46:43 -0400 Received: from smallhat.boston.devel.redhat.com (vpn-59-118.rdu2.redhat.com [10.10.59.118]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9SCkeFA002122; Mon, 28 Oct 2013 08:46:42 -0400 Message-ID: <526E5CE0.5010507@RedHat.com> Date: Mon, 28 Oct 2013 08:47:28 -0400 From: Steve Dickson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130612 Thunderbird/17.0.6 MIME-Version: 1.0 To: NeilBrown CC: Tony Asleson , NFS Subject: Re: [PATCH - nfs-utils] exportfs: report failure if asked to unexport something not exported. References: <20131028144305.0f91f025@notabene.brown> In-Reply-To: <20131028144305.0f91f025@notabene.brown> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Hello, On 27/10/13 23:43, NeilBrown wrote: > > Currently if exportfs is asked to unexport something that is not > exported it silently succeeds. This is not ideal, particularly for > scripting situations. > > So report an error unless the unexport was successful. > > Reported-by: Tony Asleson > Signed-off-by: NeilBrown > > diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c > index 52fc03d..c9e12db 100644 > --- a/utils/exportfs/exportfs.c > +++ b/utils/exportfs/exportfs.c > @@ -351,6 +351,7 @@ unexportfs(char *arg, int verbose) > char *path; > char *hname = arg; > int htype; > + int success = 0; > > if ((path = strchr(arg, ':')) != NULL) > *path++ = '\0'; > @@ -397,7 +398,10 @@ unexportfs(char *arg, int verbose) > #endif > exp->m_xtabent = 0; > exp->m_mayexport = 0; > + success = 1; > } > + if (!success) > + xlog(L_ERROR, "Could not find %s to unexport.\n", arg); > > freeaddrinfo(ai); > } > This does not apply due commit 232eb7ad0... But I agree with doing a xlog on failures but I would like to cover it with the -v flag... Something similar to : [PATCH] exportfs: report failure if asked to unexport something not exported. Currently if exportfs is asked to unexport something that is not exported it silently succeeds. This is not ideal, particularly for scripting situations. So report an error when the unexport was successful and the -v flag used. Signed-off-by: Steve Dickson --- utils/exportfs/exportfs.c | 2 ++ 1 file changed, 2 insertions(+) steved. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 318deb3..6962444 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -413,6 +413,8 @@ unexportfs(char *arg, int verbose) exp->m_mayexport = 0; rc = 1; } + if (!rc && verbose) + xlog(L_ERROR, "Could not find '%s:%s' to unexport.", arg, path); freeaddrinfo(ai); return rc;