[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: i386/4070: -current dump(8) stalls during filesystem backup



The following reply was made to PR i386/4070; it has been noted by GNATS.

From: "Todd C. Miller" <Todd_(_dot_)_Miller_(_at_)_courtesan_(_dot_)_com>
To: Ben Lovett <ben_(_at_)_tilderoot_(_dot_)_com>
Cc: gnats_(_at_)_openbsd_(_dot_)_org
Subject: Re: i386/4070: -current dump(8) stalls during filesystem backup 
Date: Fri, 21 Jan 2005 22:21:45 -0700

 I bet this is the same problem that afflicts sparc.  Try the following
 patch.
 
  - todd
 
 Index: sbin/dump/tape.c
 ===================================================================
 RCS file: /home/cvs/openbsd/src/sbin/dump/tape.c,v
 retrieving revision 1.21
 diff -u -r1.21 tape.c
 --- sbin/dump/tape.c	4 Nov 2004 20:10:07 -0000	1.21
 +++ sbin/dump/tape.c	22 Jan 2005 05:20:23 -0000
 @@ -56,7 +56,6 @@
  
  #include <errno.h>
  #include <fcntl.h>
 -#include <setjmp.h>
  #include <signal.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -121,10 +120,6 @@
  int master;		/* pid of master, for sending error signals */
  int tenths;		/* length of tape used per block written */
  static int caught;	/* have we caught the signal to proceed? */
 -static int ready;	/* have we reached the lock point without having */
 -			/* received the SIGUSR2 signal from the prev slave? */
 -static jmp_buf jmpbuf;	/* where to jump to if we are ready when the */
 -			/* SIGUSR2 arrives from the previous slave */
  
  int
  alloctape(void)
 @@ -723,9 +718,6 @@
  void
  proceed(int signo)
  {
 -
 -	if (ready)
 -		longjmp(jmpbuf, 1);
  	caught++;
  }
  
 @@ -795,10 +787,8 @@
  static void
  doslave(int cmd, int slave_number)
  {
 -	int nread;
 -	int nextslave, size, eot_count;
 -	volatile int wrote;
 -	sigset_t sigset;
 +	int nread, nextslave, size, wrote, eot_count;
 +	sigset_t nsigset, osigset;
  
  	/*
  	 * Need our own seek pointer.
 @@ -833,13 +823,14 @@
  				       quit("master/slave protocol botched.\n");
  			}
  		}
 -		if (setjmp(jmpbuf) == 0) {
 -			ready = 1;
 -			if (!caught)
 -				(void) pause();
 -		}
 -		ready = 0;
 +
 +		sigemptyset(&nsigset);
 +		sigaddset(&nsigset, SIGUSR2);
 +		sigprocmask(SIG_BLOCK, &nsigset, &osigset);
 +		while (!caught)
 +			sigsuspend(&osigset);
  		caught = 0;
 +		sigprocmask(SIG_SETMASK, &osigset, NULL);
  
  		/* Try to write the data... */
  		eot_count = 0;
 @@ -883,9 +874,9 @@
  
  		if (size < 0) {
  			(void) kill(master, SIGUSR1);
 -			sigemptyset(&sigset);
 +			sigemptyset(&nsigset);
  			for (;;)
 -				sigsuspend(&sigset);
 +				sigsuspend(&nsigset);
  		} else {
  			/*
  			 * pass size of write back to master



Visit your host, monkey.org