NetBSD Problem Report #30
From gnats Mon Nov 29 20:20:12 1993
Received: from bloom-beacon.mit.edu (BLOOM-BEACON.MIT.EDU [18.70.0.232]) by sun-lamp.cs.berkeley.edu (8.6.4/8.6.4) with SMTP id UAA26147 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 29 Nov 1993 20:20:11 -0800
Message-Id: <199311300411.XAA01197@orchard.medford.ma.us>
Date: Mon, 29 Nov 1993 23:11:37 -0500
From: sommerfeld@orchard.medford.ma.us
Reply-To: sommerfeld@orchard.medford.ma.us
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: fsync on pipe fails
X-Send-Pr-Version: 3.01.6
>Number: 30
>Category: kern
>Synopsis: fsync() on pipe fails with EINVAL
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 29 20:35:02 +0000 1993
>Closed-Date: Wed Dec 01 10:58:25 +0000 1993
>Last-Modified:
>Originator: Bill Sommerfeld
>Release: NetBSD 0.9, NetBSD-current
>Organization:
Self
>Environment:
i[34]86
System: NetBSD orchard.medford.ma.us 0.9a ORCHARD#11 i386
>Description:
fsync() on a pipe fails, returning EINVAL.
This breaks RCS, which expects to fsync all of its I/O before
closing it.
>How-To-Repeat:
rlog foo,v | cat
Note that rlog fails with an "output error"
This problem was first seen with emacs 19 "vc" (version-control) mode, which
runs RCS commands in subprocesses, connected to the main emacs using a pipe.
>Fix:
Apply following patch to /sys/kern/vfs_syscalls.c
alternatively:
(more work)
fix rlog and anything else which might fsync() a pipe/socket
or (even more work)
implement fsync() on sockets -> wait until all queued output is drained.
*** 1.1 1993/11/24 22:06:05
--- 1.2 1993/11/28 17:33:35
***************
*** 1565,1572 ****
struct file *fp;
int error;
! if (error = getvnode(p->p_fd, uap->fd, &fp))
return (error);
vp = (struct vnode *)fp->f_data;
VOP_LOCK(vp);
error = VOP_FSYNC(vp, fp->f_flag, fp->f_cred, MNT_WAIT, p);
--- 1565,1575 ----
struct file *fp;
int error;
! if (error = getvnode(p->p_fd, uap->fd, &fp)) {
! if (error == EINVAL)
! error = 0;
return (error);
+ }
vp = (struct vnode *)fp->f_data;
VOP_LOCK(vp);
error = VOP_FSYNC(vp, fp->f_flag, fp->f_cred, MNT_WAIT, p);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jtc
State-Changed-When: Wed Dec 1 10:58:25 1993
State-Changed-Why:
Not a bug -- fsync has always failed on sockets.
Bug in RCS was introduced by a NetBSD change and has been fixed by cgd.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.