From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 27 11:08:23 2012 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 11DBE106566B; Fri, 27 Jul 2012 11:08:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by mx1.freebsd.org (Postfix) with ESMTP id 6DF5C8FC19; Fri, 27 Jul 2012 11:08:22 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q6RB8DCK016920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Jul 2012 21:08:14 +1000 Date: Fri, 27 Jul 2012 21:08:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: davidxu@FreeBSD.org In-Reply-To: <501256C6.5000307@gmail.com> Message-ID: <20120727210330.L6869@besplex.bde.org> References: <201207262256.q6QMurVf077480@red.freebsd.org> <20120727103622.B933@besplex.bde.org> <501256C6.5000307@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Garrett Cooper , freebsd-bugs@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org, Bruce Evans Subject: Re: kern/170203: [kern] piped dd's don't behave sanely when dealing with a fifo 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: Fri, 27 Jul 2012 11:08:23 -0000 On Fri, 27 Jul 2012, David Xu wrote: > On 2012/7/27 10:07, Bruce Evans wrote: >> >> I think it's working almost as expected. Large blocks give non-atomic >> I/O, so the reader sees small blocks, then EOF when it gets ahead of >> the writer. This always happens without SMP. >> >> Not is a bug (debugged below). There is no SIGPIPE at the start of >> write() because there is a reader then, and no SIGPIPE for the next >> write() because there is no next write() -- the current one doesn't >> notice when the reader goes away. >> > After fixed dd to not open fifo output file in O_RDWR mode, I still found the > writer is blocked there even the reader is already exited. I'm not sure that dd's open is a bug. It must be intentional to use O_RDWR for some cases. POSIX (old 2001 draft) doesn't say anything about dd's open mode. > I think this is definitely a bug. if reader is exited, the writer should be > aborted too, > but I found it still be blocked in state "pipedwt", obviously, the code in > /sys/fs/fifo_vnops.c wants to wake up the writer when the reader is closing > the fifo, > but it failed, because the bit flag PIPE_WANTW is forgotten to be set by > writer, > so it skips executing wakeup(), and then the writer has no chance to find EOF > bit flag > is set. Does this affect nameless pipes too? The old implementation presumably doesn't have this bug. Bruce