From bakhtin@amt.ru Thu Mar 1 06:13:18 2001 Return-Path: Received: from bakhtin.amt.ru (station113.amt.ru [212.111.64.113]) by hub.freebsd.org (Postfix) with ESMTP id E942C37B719 for ; Thu, 1 Mar 2001 06:13:16 -0800 (PST) (envelope-from bakhtin@amt.ru) Received: (from bakhtin@localhost) by bakhtin.amt.ru (8.11.2/8.11.2) id f21EDE201343; Thu, 1 Mar 2001 17:13:14 +0300 (MSK) (envelope-from bakhtin) Message-Id: <200103011413.f21EDE201343@bakhtin.amt.ru> Date: Thu, 1 Mar 2001 17:13:14 +0300 (MSK) From: bakhtin@amt.ru Reply-To: bakhtin@amt.ru To: FreeBSD-gnats-submit@freebsd.org Subject: dump can't close fifo pipe correctly X-Send-Pr-Version: 3.2 >Number: 25474 >Category: bin >Synopsis: dump can't close fifo pipe correctly >Confidential: no >Severity: non-critical >Priority: low >Responsible: iedowse >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 01 06:20:01 PST 2001 >Closed-Date: Tue Feb 19 16:05:48 PST 2002 >Last-Modified: Tue Feb 19 16:06:30 PST 2002 >Originator: Alex Bakhtin >Release: FreeBSD 4.2-STABLE i386 >Organization: AMT Group >Environment: {bakhtin}/home/bakhtin/work/dump>uname -a FreeBSD bakhtin.amt.ru 4.2-STABLE FreeBSD 4.2-STABLE #1: Tue Feb 6 17:26:00 MSK 2001 root@bakhtin.amt.ru:/mnt/srcs/src/sys/compile/BAKHTIN i386 >Description: I'm trying to dump my filesystems to fifo pipe (created by mkfifo) and have got a problem. If we use dump -f FILE and FILE is fifo, it dumps fs fine, but after that it fails to close this file. Looking into dump sources (tape.c file) I have found a problem: after closing the file it tries to reopen it several times: while ((f = open(tape, 0)) < 0) sleep (10); (void) close(f); And because nobody is listening at the other end of this pipe, we'll wait for a long time... >How-To-Repeat: mkfifo PIPE dd if=PIPE of=/dev/null& dump -0 -f PIPE / >Fix: {bakhtin}/home/bakhtin/work/dump>diff tape.c /usr/src/sbin/dump/tape.c 46d45 < #include ! 326d324 < struct stat sp; 369d366 < fstat(tapefd,&sp); 371d367 < if(S_ISFIFO(sp.st_mode)) return; >Release-Note: >Audit-Trail: From: David Malone To: bakhtin@amt.ru Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/25474: dump can't close fifo pipe correctly Date: Thu, 1 Mar 2001 15:21:42 +0000 On Thu, Mar 01, 2001 at 05:13:14PM +0300, bakhtin@amt.ru wrote: > >Description: > > I'm trying to dump my filesystems to fifo pipe (created by mkfifo) and > have got a problem. If we use dump -f FILE and FILE is fifo, it dumps > fs fine, but after that it fails to close this file. Looking into dump sources > (tape.c file) I have found a problem: after closing the file it tries to > reopen it several times: > while ((f = open(tape, 0)) < 0) > sleep (10); > (void) close(f); > > And because nobody is listening at the other end of this pipe, > we'll wait for a long time... Using dump -f doesn't seem to work that well for anything but tapes unless you specify stdout. I'd recommend that you try: dump -f - /usr > /my/fifo The man page should probably indicate that this is the case. David. From: Alex Bakhtin To: David Malone Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/25474: dump can't close fifo pipe correctly Date: 02 Mar 2001 10:01:03 +0300 >>>>> "DM" == David Malone writes: David, >> I'm trying to dump my filesystems to fifo pipe (created by mkfifo) and >> have got a problem. If we use dump -f FILE and FILE is fifo, it dumps >> fs fine, but after that it fails to close this file. Looking into dump sources >> (tape.c file) I have found a problem: after closing the file it tries to >> reopen it several times: >> while ((f = open(tape, 0)) < 0) >> sleep (10); >> (void) close(f); >> >> And because nobody is listening at the other end of this pipe, >> we'll wait for a long time... DM> Using dump -f doesn't seem to work that well for anything but tapes DM> unless you specify stdout. I'd recommend that you try: DM> dump -f - /usr > /my/fifo DM> The man page should probably indicate that this is the case. In this case it's impossible to split DUMP archive into volumes. The problem with closing file is the only one with FIFO pipes. ================== {bakhtin}/home/bakhtin>dump -B 1000 -f - / > /dev/null DUMP: Date of this level 0 dump: Fri Mar 2 09:52:52 2001 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/da0s1a (/) to standard output DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 34303 tape blocks. DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] DUMP: DUMP: 34317 tape blocks DUMP: finished in 31 seconds, throughput 1107 KBytes/sec DUMP: DUMP IS DONE ================== / is only an example. I'll try to describe what I'm trying to do. I'm trying to backup my filesystems to CDRW disks in my CDRW drive. I have discovered that it is possible to do without making ISO9660 FS on CDRW disk, I can just redirect all output from dump to cdrecord. But ALL my FSs (except / ) are bigger than CDRW disk (650M), so I need to make multi-volume backup. When DUMP is writing to STDOUT, it can't split file into volumes. So, it seems that FIFO pipe is a good way to do such backups. -- Best regards, -- Alex Bakhtin. AMT Group, Cisco Systems Gold Partner, http://www.amt.ru From: Alex Bakhtin To: David Malone Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/25474: dump can't close fifo pipe correctly Date: 07 Mar 2001 12:45:12 +0300 David, Have you received my explanation? -- Best regards, -- Alex Bakhtin. AMT Group, Cisco Systems Gold Partner, http://www.amt.ru State-Changed-From-To: open->feedback State-Changed-By: iedowse State-Changed-When: Wed Nov 21 10:41:10 PST 2001 State-Changed-Why: Could you supply a patch using the "-u" option to diff? Without some context it's difficult to see what is being changed. Making dump work with FIFOs seems like a useful addition. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25474 State-Changed-From-To: feedback->suspended State-Changed-By: iedowse State-Changed-When: Sun Feb 10 16:56:08 PST 2002 State-Changed-Why: Committed (with minor style adjustments), thanks! Responsible-Changed-From-To: freebsd-bugs->iedowse Responsible-Changed-By: iedowse Responsible-Changed-When: Sun Feb 10 16:56:08 PST 2002 Responsible-Changed-Why: My MFC reminder. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25474 State-Changed-From-To: suspended->closed State-Changed-By: iedowse State-Changed-When: Tue Feb 19 16:05:48 PST 2002 State-Changed-Why: Merged into -STABLE now too. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25474 >Unformatted: