linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 04/15] mount.nfs: Eliminate compiler warnings
Date: Mon, 11 Oct 2010 09:32:06 -0400	[thread overview]
Message-ID: <4CB311D6.2000503@RedHat.com> (raw)
In-Reply-To: <20101011000441.6667.68536.stgit@ellison.1015granger.net>



On 10/10/2010 08:04 PM, Chuck Lever wrote:
> Clean up.
> 
> fstab.c: In function ‘lock_mtab’:
> fstab.c:385: warning: declaration of ‘errsv’ shadows a previous local
> fstab.c:367: warning: shadowed declaration is here
> fstab.c:407: warning: declaration of ‘errsv’ shadows a previous local
> fstab.c:367: warning: shadowed declaration is here
> fstab.c:417: warning: declaration of ‘tries’ shadows a previous local
> fstab.c:325: warning: shadowed declaration is here
> fstab.c:422: warning: declaration of ‘errsv’ shadows a previous local
> fstab.c:367: warning: shadowed declaration is here
Could you please post the gcc flags you using to generate 
theses warnings... These warnings are not being generated with
the default gcc flags we are currently using... 

tia,

steved.

> These are probably harmless.  Reusing a variable name, however, is a
> little confusing to follow when reading the code.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 
>  utils/mount/fstab.c |   29 ++++++++++++++++-------------
>  1 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/utils/mount/fstab.c b/utils/mount/fstab.c
> index 051fa38..a742e64 100644
> --- a/utils/mount/fstab.c
> +++ b/utils/mount/fstab.c
> @@ -364,19 +364,22 @@ lock_mtab (void) {
>  	/* Repeat until it was us who made the link */
>  	while (!we_created_lockfile) {
>  		struct flock flock;
> -		int errsv, j;
> +		int j;
>  
>  		j = link(linktargetfile, MOUNTED_LOCK);
> -		errsv = errno;
>  
> -		if (j == 0)
> -			we_created_lockfile = 1;
> +		{
> +			int errsv = errno;
>  
> -		if (j < 0 && errsv != EEXIST) {
> -			(void) unlink(linktargetfile);
> -			die (EX_FILEIO, _("can't link lock file %s: %s "
> -			     "(use -n flag to override)"),
> -			     MOUNTED_LOCK, strerror (errsv));
> +			if (j == 0)
> +				we_created_lockfile = 1;
> +
> +			if (j < 0 && errsv != EEXIST) {
> +				(void) unlink(linktargetfile);
> +				die (EX_FILEIO, _("can't link lock file %s: %s "
> +				     "(use -n flag to override)"),
> +				     MOUNTED_LOCK, strerror (errsv));
> +			}
>  		}
>  
>  		lockfile_fd = open (MOUNTED_LOCK, O_WRONLY);
> @@ -414,7 +417,7 @@ lock_mtab (void) {
>  			}
>  			(void) unlink(linktargetfile);
>  		} else {
> -			static int tries = 0;
> +			static int retries = 0;
>  
>  			/* Someone else made the link. Wait. */
>  			alarm(LOCK_TIMEOUT);
> @@ -428,10 +431,10 @@ lock_mtab (void) {
>  			alarm(0);
>  			/* Limit the number of iterations - maybe there
>  			   still is some old /etc/mtab~ */
> -			++tries;
> -			if (tries % 200 == 0)
> +			++retries;
> +			if (retries % 200 == 0)
>  			   usleep(30);
> -			if (tries > 100000) {
> +			if (retries > 100000) {
>  				(void) unlink(linktargetfile);
>  				close(lockfile_fd);
>  				die (EX_FILEIO, _("Cannot create link %s\n"
> 

  reply	other threads:[~2010-10-11 13:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11  0:04 [PATCH 00/15] Fixes for nfs-utils-1.2.4 Chuck Lever
2010-10-11  0:04 ` [PATCH 01/15] mountd: Clear mountd registrations at start up Chuck Lever
2010-10-13 14:55   ` Steve Dickson
2010-10-13 15:12     ` Steve Dickson
2010-10-13 20:12       ` Chuck Lever
2010-10-13 20:39         ` Steve Dickson
2010-10-14 13:21         ` Steve Dickson
2010-10-11  0:04 ` [PATCH 02/15] libnfs.a: Allow multiple RPC listeners to share listener port number Chuck Lever
2010-10-11  0:20   ` Jim Rees
2010-10-11 13:22     ` Steve Dickson
2010-10-11 16:04       ` Chuck Lever
2010-10-11 20:00         ` Jim Rees
     [not found]           ` <20101011200017.GA2451-8f4Pc2RrbJmHXe+LvDLADg@public.gmane.org>
2010-10-13 14:17             ` Steve Dickson
2010-10-11  0:04 ` [PATCH 03/15] export: Ensure that we free struct exportent->e_uuid Chuck Lever
2010-10-11  0:04 ` [PATCH 04/15] mount.nfs: Eliminate compiler warnings Chuck Lever
2010-10-11 13:32   ` Steve Dickson [this message]
2010-10-11 16:18     ` Chuck Lever
2010-10-11 16:45       ` Steve Dickson
2010-10-11  0:04 ` [PATCH 05/15] mount.nfs: Eliminate compiler warning in utils/mount/mount.c Chuck Lever
2010-10-11  0:05 ` [PATCH 06/15] mount.nfs: Eliminate compiler warnings in utils/mount/version.h Chuck Lever
2010-10-11  0:05 ` [PATCH 07/15] mount.nfs: Eliminate compiler warning in utils/mount/mount.c Chuck Lever
2010-10-11  0:05 ` [PATCH 08/15] mount.nfs: Eliminate compiler warnings " Chuck Lever
2010-10-11  0:05 ` [PATCH 09/15] mount.nfs: Eliminate compiler warning in utils/mount/nfsumount.c Chuck Lever
2010-10-11  0:05 ` [PATCH 10/15] " Chuck Lever
2010-10-11  0:05 ` [PATCH 11/15] mount.nfs: Eliminate compiler warning in utils/mount/parse_opt.c Chuck Lever
2010-10-11  0:06 ` [PATCH 12/15] mount.nfs: Eliminate compiler warnings in utils/mount/network.c Chuck Lever
2010-10-11  0:06 ` [PATCH 13/15] mount.nfs: mountproto does not support RDMA Chuck Lever
2010-10-11  0:06 ` [PATCH 14/15] umount.nfs: Distinguish between nfs4 and nfs mounts Chuck Lever
2010-10-11  0:06 ` [PATCH 15/15] mount.nfs: don't show "remount" flag in /etc/mtab Chuck Lever
2010-10-11  4:16 ` [PATCH 00/15] Fixes for nfs-utils-1.2.4 Neil Brown
2010-10-11 15:18   ` Chuck Lever
     [not found] ` <20101010234836.6667.4057.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2010-10-14 14:37   ` 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=4CB311D6.2000503@RedHat.com \
    --to=steved@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).