NetBSD Problem Report #36429

From yamt@mwd.biglobe.ne.jp  Sat Jun  2 19:28:56 2007
Return-Path: <yamt@mwd.biglobe.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 03DD763B880
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  2 Jun 2007 19:28:56 +0000 (UTC)
Message-Id: <20070602154231.3A85111702@yamt.dyndns.org>
Date: Sun,  3 Jun 2007 00:42:31 +0900 (JST)
From: yamt@mwd.biglobe.ne.jp
Reply-To: yamt@mwd.biglobe.ne.jp
To: gnats-bugs@NetBSD.org
Subject: EIO with puffs/dtfs
X-Send-Pr-Version: 3.95

>Number:         36429
>Category:       kern
>Synopsis:       EIO with puffs/dtfs
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pooka
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 02 19:30:00 +0000 2007
>Closed-Date:    Sun Jul 22 18:23:04 +0000 2007
>Last-Modified:  Thu Aug 19 02:40:02 +0000 2010
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 4.99.20
>Organization:

>Environment:
Architecture: i386
Machine: i386
>Description:

	a strange EIO with the following code.

	% sudo ./obj/dtfs /mnt
	% mount
	<snip>
	puffs:dt on /mnt type puffs
	<snip>

	% cc a.c
	% ./a.out /mnt/b
	a.out: pwrite2: Input/output error

-------------------------------------------------- a.c
#include <err.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
	const char *filename;
	int fd;
	ssize_t ssz;
	char buf[1024*1024];

	filename = argv[1];
	fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666);
	if (fd < 0)
		err(1, "open");

	memset(buf, 'A', sizeof(buf));
	ssz = pwrite(fd, buf, 1, 0x1000);
	if (ssz == -1) {
		warn("pwrite1");
	}
	memset(buf, 'B', sizeof(buf));
	ssz = pwrite(fd, buf, 2, 0xfff);
	if (ssz == -1) {
		warn("pwrite2");
	}

	exit(0);
}
--------------------------------------------------

>How-To-Repeat:
	see above.
>Fix:


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->pooka
Responsible-Changed-By: pooka@netbsd.org
Responsible-Changed-When: Mon, 04 Jun 2007 16:05:50 +0300
Responsible-Changed-Why:
my fun


State-Changed-From-To: open->analyzed
State-Changed-By: pooka@netbsd.org
State-Changed-When: Tue, 05 Jun 2007 15:32:49 +0300
State-Changed-Why:
Ok, so the problem is the following: after the write to the second 
page the size of the vnode is large enough so that the first page  
is going to be faulted in.  However, since the information about 
the file size extension is only in the kernel (not yet flushed),  
the read fault of the first page results in the file server thinking
someone is trying to read past eof and hence it returns 0 bytes,
which the nestiobuf code doesn't like and gives EIO.

I need to do a bit more vacation recovery before I can decide how
to really fix it.  By mounting with PUFFS_KFLAG_WTCACHE the problem 
does exist, as the cache is flushed immediately - that's the  
behaviour that most file servers actually want anyway.  You can
make dtfs do this by running it with -t.


State-Changed-From-To: analyzed->closed
State-Changed-By: pooka@netbsd.org
State-Changed-When: Sun, 22 Jul 2007 21:23:04 +0300
State-Changed-Why:
fixed.  thanks for the report!


From: Antti Kantee <pooka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36429 CVS commit: src/tests/fs/vfs
Date: Thu, 19 Aug 2010 02:36:03 +0000

 Module Name:	src
 Committed By:	pooka
 Date:		Thu Aug 19 02:36:03 UTC 2010

 Modified Files:
 	src/tests/fs/vfs: Makefile
 Added Files:
 	src/tests/fs/vfs: t_io.c

 Log Message:
 Start adding some I/O tests.  This one does a sparse write to the
 second page on a file, then writes the first, and finally checks
 it can read something expected.  Adapted the from program supplied
 by yamt in PR kern/36429.


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_io.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.