linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: jonathan.dascenzo@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] fix tlock.c to use sigaction() over deprecated signal(). Fixes sync issues when client is loaded. (Particularly test12)
Date: Tue, 11 Mar 2014 15:17:26 -0400	[thread overview]
Message-ID: <531F6146.2060807@RedHat.com> (raw)
In-Reply-To: <1393268734-23325-1-git-send-email-jonathan.dascenzo@netapp.com>



On 02/24/2014 02:05 PM, jonathan.dascenzo@netapp.com wrote:
> From: Jonathan Dascenzo <Jonathan.Dascenzo@netapp.com>
> 
> ---
>  lock/tlock.c |   30 ++++++++++++++++++++++--------
>  1 file changed, 22 insertions(+), 8 deletions(-)
Committed....

steved.

> 
> diff --git a/lock/tlock.c b/lock/tlock.c
> index 8a7d0cc..39a6ad9 100644
> --- a/lock/tlock.c
> +++ b/lock/tlock.c
> @@ -272,20 +272,24 @@ testexit(nok)
>  	int nok;
>  {
>  
> +	struct sigaction act;
>  	close_testfile(DO_UNLINK);
>  	if (nok) {
>  		testreport(1);
>  	}
>  	if (who == PARENT) {
> -		signal(SIGCLD, SIG_DFL);
> +		act.sa_handler = SIG_DFL;
> +		sigaction(SIGCLD, &act, NULL);
>  		if (nok) {
> -			signal(SIGINT, SIG_IGN);
> +			act.sa_handler = SIG_IGN;
> +			sigaction(SIGINT, &act, NULL);
>  			kill(childpid, SIGINT);
>  		}
>  		wait((int *)0);
>  	} else {
>  		if (nok) {
> -			signal(SIGINT, SIG_IGN);
> +			act.sa_handler = SIG_IGN;
> +			sigaction(SIGINT, &act, NULL);
>  			kill(parentpid, SIGINT);
>  		}
>  	}
> @@ -1450,7 +1454,9 @@ test12()
>  			close_testfile(DO_UNLINK);
>  		} else {
>  			/* subchild */
> -			signal(SIGINT, SIG_DFL);
> +			struct sigaction act;
> +			act.sa_handler = SIG_DFL;
> +			sigaction(SIGINT, &act, NULL);
>  			test(12, 0, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL);
>  			for (;;)
>  				sleep(1);
> @@ -1667,13 +1673,19 @@ main(argc, argv)
>  	/*
>  	 * Fork child...
>  	 */
> +	struct sigaction act; 
> +	act.sa_handler = SIG_DFL;
>  	if ((childpid = fork()) == 0) {
>  		who = CHILD;
> -		signal(SIGINT, parentsig);
> +		sigaction(SIGINT, &act, NULL);
> +		act.sa_handler = parentsig;
> +		sigaction(SIGINT, &act, NULL);
>  	} else {
>  		who = PARENT;
> -		signal(SIGINT, childsig);
> -		signal(SIGCLD, childdied);
> +		act.sa_handler = childsig;
> +		sigaction(SIGINT, &act, NULL);
> +		act.sa_handler = childdied;
> +		sigaction(SIGCLD, &act, NULL);
>  	}
>  
>  	/*
> @@ -1692,7 +1704,9 @@ main(argc, argv)
>  	if (who == CHILD) {
>  		childwait();
>  	} else {
> -		signal(SIGCLD, SIG_DFL);
> +		struct sigaction;
> +		act.sa_handler = SIG_DFL;
> +		sigaction(SIGCLD, &act, NULL);
>  		childfree(0);
>  	}
>  	testexit(0);
> 

      reply	other threads:[~2014-03-11 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 19:05 [PATCH 1/1] fix tlock.c to use sigaction() over deprecated signal(). Fixes sync issues when client is loaded. (Particularly test12) jonathan.dascenzo
2014-03-11 19:17 ` Steve Dickson [this message]

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=531F6146.2060807@RedHat.com \
    --to=steved@redhat.com \
    --cc=jonathan.dascenzo@netapp.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).