All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: NeilBrown <neilb@suse.de>
Cc: Tony Asleson <tasleson@redhat.com>, NFS <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH - nfs-utils] exportfs: report failure if asked to unexport something not exported.
Date: Mon, 28 Oct 2013 08:47:28 -0400	[thread overview]
Message-ID: <526E5CE0.5010507@RedHat.com> (raw)
In-Reply-To: <20131028144305.0f91f025@notabene.brown>

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 <tasleson@redhat.com>
> Signed-off-by: NeilBrown <neilb@suse.de>
> 
> 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 <steved@redhat.com>
---
 utils/exportfs/exportfs.c | 2 ++
 1 file changed, 2 insertions(+)

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;


steved.

  reply	other threads:[~2013-10-28 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28  3:43 [PATCH - nfs-utils] exportfs: report failure if asked to unexport something not exported NeilBrown
2013-10-28 12:47 ` Steve Dickson [this message]
2013-10-28 18:29   ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526E5CE0.5010507@RedHat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=tasleson@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.