NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/47980: NFS over-quota not detected if utimes() called before fsync()/close()
>Number: 47980
>Category: kern
>Synopsis: NFS over-quota not detected if utimes() called before
>fsync()/close()
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 01 11:40:00 +0000 2013
>Originator: Edgar Fuß <ef%math.uni-bonn.de@localhost>
>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@localhost:/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:
Home |
Main Index |
Thread Index |
Old Index