From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 6 11:49:55 2007 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AB4016A419; Tue, 6 Nov 2007 11:49:55 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from cs1.cs.huji.ac.il (cs1.cs.huji.ac.il [132.65.16.10]) by mx1.freebsd.org (Postfix) with ESMTP id B42BE13C4B3; Tue, 6 Nov 2007 11:49:54 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by cs1.cs.huji.ac.il with esmtp id 1IpMw3-000Mw7-E0; Tue, 06 Nov 2007 13:49:35 +0200 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: iedowse@FreeBSD.org In-reply-to: Your message of Sun, 4 Nov 2007 11:27:51 GMT . Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_1194349753_547800" Date: Tue, 06 Nov 2007 13:49:35 +0200 From: Danny Braniss Message-ID: Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/117603: [patch] dump(8) hangs on SMP - 4way and higher. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Nov 2007 11:49:55 -0000 This is a multipart MIME message. --==_Exmh_1194349753_547800 Content-Type: text/plain; charset=us-ascii hi, [latest follow up] doing sigfillset(&s_mask); sigdelset(&s_mask, SIGUSR2); takes care of unwanted signals. so here is my latest proposed patch. --==_Exmh_1194349753_547800 Content-Type: text/plain ; name="dump.c.diffs"; charset=us-ascii Content-Description: dump.c.diffs Content-Disposition: attachment; filename="dump.c.diffs" --- tape.c.orig Wed Mar 2 04:30:08 2005 +++ tape.c Sun Nov 4 13:42:55 2007 @@ -109,11 +109,6 @@ int master; /* pid of master, for sending error signals */ int tenths; /* length of tape used per block written */ -static volatile sig_atomic_t caught; /* have we caught the signal to proceed? */ -static volatile sig_atomic_t ready; /* 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) @@ -685,15 +680,13 @@ void proceed(int signo __unused) { - - if (ready) - longjmp(jmpbuf, 1); - caught++; + // do nothing ... } void enslave(void) { + sigset_t s_mask; int cmd[2]; int i, j; @@ -704,13 +697,11 @@ signal(SIGUSR1, tperror); /* Slave sends SIGUSR1 on tape errors */ signal(SIGUSR2, proceed); /* Slave sends SIGUSR2 to next slave */ - for (i = 0; i < SLAVES; i++) { - if (i == slp - &slaves[0]) { - caught = 1; - } else { - caught = 0; - } + sigemptyset(&s_mask); + sigaddset(&s_mask, SIGUSR2); + sigprocmask(SIG_BLOCK, &s_mask, NULL); + for (i = 0; i < SLAVES; i++) { if (socketpair(AF_UNIX, SOCK_STREAM, 0, cmd) < 0 || (slaves[i].pid = fork()) < 0) quit("too many slaves, %d (recompile smaller): %s\n", @@ -733,6 +724,7 @@ sizeof slaves[0].pid); master = 0; + kill(slp->pid, SIGUSR2); // start the ball rolling } void @@ -757,6 +749,7 @@ static void doslave(int cmd, int slave_number) { + sigset_t s_mask; int nread; int nextslave, size, wrote, eot_count; @@ -774,7 +767,7 @@ != sizeof nextslave) { quit("master/slave protocol botched - didn't get pid of next slave.\n"); } - + sigemptyset(&s_mask); /* * Get list of blocks to dump, read the blocks into tape buffer */ @@ -793,14 +786,7 @@ quit("master/slave protocol botched.\n"); } } - if (setjmp(jmpbuf) == 0) { - ready = 1; - if (!caught) - (void) pause(); - } - ready = 0; - caught = 0; - + sigsuspend(&s_mask); /* Try to write the data... */ eot_count = 0; size = 0; --==_Exmh_1194349753_547800--