NetBSD Problem Report #47980

From ef@math.uni-bonn.de  Mon Jul  1 11:36:43 2013
Return-Path: <ef@math.uni-bonn.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 92A2170B7B
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Jul 2013 11:36:43 +0000 (UTC)
Message-Id: <20130701113639.E646B1BD49@trave.math.uni-bonn.de>
Date: Mon,  1 Jul 2013 13:36:39 +0200 (CEST)
From: ef@math.uni-bonn.de
Reply-To: ef@math.uni-bonn.de
To: gnats-bugs@gnats.NetBSD.org
Subject: NFS over-quota not detected if utimes() called before fsync()/close()
X-Send-Pr-Version: 3.95

>Number:         47980
>Category:       kern
>Synopsis:       NFS over-quota not detected if utimes() called before fsync()/close()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    hannken
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 11:40:00 +0000 2013
>Closed-Date:    Sun Sep 15 16:24:10 +0000 2013
>Last-Modified:  Sun Sep 15 16:24:10 +0000 2013
>Originator:     Edgar Fuß <ef@math.uni-bonn.de>
>Release:        NetBSD 6.1
>Organization:
	Mathematisches Institut der Uni Bonn
>Environment:
System: NetBSD trave.math.uni-bonn.de 6.1 NetBSD 6.1 (MI12serv) #17: Sun May 19 18:22:29 CEST 2013 support@trave.math.uni-bonn.de:/usr/obj/sys/arch/amd64/compile/mi12serv amd64
Architecture: x86_64
Machine: amd64
>Description:
	On an NFS-mounted file system, when you try to write to a file and are
	over-quota, the write() succeeds, but a following fsync() or close() fails.
	However, when you insert a utimes() or futimes() call after the write(),
	the fsync() or close() succeed and you end up with a zero-length file.

	The effect for us is dovecot's LDA not bouncing mail for users having exceeded
	their mail quota, but reporting successful delivery and losing mail.
>How-To-Repeat:
	Run this (compiled with either -DUTIMES or -DFUTIMES) with an argument
	naming a file on an NFS:

	#include <unistd.h>
	#include <err.h>
	#include <fcntl.h>
	#include <sys/time.h>

	int main(int argc, char *argv[]) {
		int fd;
		if (argc != 2) errx(1, "argc");
		if (!*argv[1]) errx(1, "argv");
		if ((fd = open(argv[1], O_RDWR | O_CREAT, 0666)) < 0) err(1, "open");
		if (write(fd, &fd, 1) != 1) err(1, "write");
	#ifdef UTIMES
		if (utimes(argv[1], NULL) < 0) err(1, "utimes");
	#endif
	#ifdef FUTIMES
		if (futimes(fd, NULL) < 0) err(1, "futimes");
	#endif
	#ifdef FSYNC
		if (fsync(fd) < 0) err(1, "fsync");
	#endif
		if (close(fd) < 0) err(1, "close");
	}
>Fix:


>Release-Note:

>Audit-Trail:
From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47980 CVS commit: src/sys/nfs
Date: Mon, 12 Aug 2013 17:46:38 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Mon Aug 12 17:46:38 UTC 2013

 Modified Files:
 	src/sys/nfs: nfs_bio.c

 Log Message:
 Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore
 delayed write errors may get lost.
 Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or close().

 Presented on tech-kern@

 Fix for PR kern/47980 (NFS over-quota not detected if utimes() called
 before fsync()/close())


 To generate a diff of this commit:
 cvs rdiff -u -r1.188 -r1.189 src/sys/nfs/nfs_bio.c

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

Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: hannken@NetBSD.org
Responsible-Changed-When: Wed, 14 Aug 2013 08:58:03 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->pending-pullups
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Wed, 14 Aug 2013 08:58:03 +0000
State-Changed-Why:
Fixed on head - pullup to all NetBSD-6 releases requested (ticket 933).


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47980 CVS commit: [netbsd-6] src/sys/nfs
Date: Sat, 7 Sep 2013 16:08:13 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Sep  7 16:08:13 UTC 2013

 Modified Files:
 	src/sys/nfs [netbsd-6]: nfs_bio.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #933):
 	sys/nfs/nfs_bio.c: revision 1.189
 Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore
 delayed write errors may get lost.
 Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or =
 close().
 =20
 Presented on tech-kern@
 =20
 Fix for PR kern/47980 (NFS over-quota not detected if utimes() called
 before fsync()/close())
 =20
 =20


 To generate a diff of this commit:
 cvs rdiff -u -r1.188 -r1.188.8.1 src/sys/nfs/nfs_bio.c

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

From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47980 CVS commit: [netbsd-6-0] src/sys/nfs
Date: Sat, 7 Sep 2013 16:08:20 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Sep  7 16:08:20 UTC 2013

 Modified Files:
 	src/sys/nfs [netbsd-6-0]: nfs_bio.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #933):
 	sys/nfs/nfs_bio.c: revision 1.189
 Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore
 delayed write errors may get lost.
 Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or =
 close().
 =20
 Presented on tech-kern@
 =20
 Fix for PR kern/47980 (NFS over-quota not detected if utimes() called
 before fsync()/close())
 =20
 =20


 To generate a diff of this commit:
 cvs rdiff -u -r1.188 -r1.188.14.1 src/sys/nfs/nfs_bio.c

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

From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47980 CVS commit: [netbsd-6-1] src/sys/nfs
Date: Sat, 7 Sep 2013 16:08:28 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Sep  7 16:08:28 UTC 2013

 Modified Files:
 	src/sys/nfs [netbsd-6-1]: nfs_bio.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #933):
 	sys/nfs/nfs_bio.c: revision 1.189
 Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore
 delayed write errors may get lost.
 Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or =
 close().
 =20
 Presented on tech-kern@
 =20
 Fix for PR kern/47980 (NFS over-quota not detected if utimes() called
 before fsync()/close())
 =20
 =20


 To generate a diff of this commit:
 cvs rdiff -u -r1.188 -r1.188.22.1 src/sys/nfs/nfs_bio.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Sun, 15 Sep 2013 16:24:10 +0000
State-Changed-Why:
Pulled up.


>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.