mirror of https://github.com/mkerrisk/man-pages
write.2, fsync.2, close.2: update description of error codes
Since 4.13, errors from writeback are more reliably reported to all file descriptors that might be relevant. Add notes to this effect, and also add detail about ENOSPC and EDQUOT which can be delayed in a similar many to EIO - for NFS in particular. Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
bf1420bb85
commit
9c93cce7a7
|
@ -82,6 +82,15 @@ call was interrupted by a signal; see
|
|||
.TP
|
||||
.B EIO
|
||||
An I/O error occurred.
|
||||
.TP
|
||||
.BR ENOSPC ", " EDQUOT
|
||||
On NFS, these errors are not normally reported against the first write
|
||||
which exceeds the available storage space, but instead against a
|
||||
subsequent
|
||||
.BR write (2),
|
||||
.BR fsync (2),
|
||||
or
|
||||
.BR close (2).
|
||||
.PP
|
||||
See NOTES for a discussion of why
|
||||
.BR close ()
|
||||
|
|
18
man2/fsync.2
18
man2/fsync.2
|
@ -121,7 +121,15 @@ is set appropriately.
|
|||
is not a valid open file descriptor.
|
||||
.TP
|
||||
.B EIO
|
||||
An error occurred during synchronization.
|
||||
An error occurred during synchronization. This error may relate
|
||||
to data written to some other file descriptor on the same file.
|
||||
.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
|
||||
Since Linux 4.13, errors from write-back will be reported to
|
||||
all file descriptors that might have written the data which triggered
|
||||
the error. Some filesystems (e.g. NFS) keep close track of which data
|
||||
came through which file descriptor, and give more precise reporting.
|
||||
Other filesystems (e.g. most local filesystems) will report errors to
|
||||
all file descriptors that where open on the file when the error was recorded.
|
||||
.TP
|
||||
.B ENOSPC
|
||||
Disk space was exhausted while synchronizing.
|
||||
|
@ -130,6 +138,14 @@ Disk space was exhausted while synchronizing.
|
|||
.I fd
|
||||
is bound to a special file (e.g., a pipe, FIFO, or socket)
|
||||
which does not support synchronization.
|
||||
.TP
|
||||
.BR ENOSPC ", " EDQUOT
|
||||
.I fd
|
||||
is bound to a file on NFS or another filesystem which does not allocate
|
||||
space at the time of a
|
||||
.BR write (2)
|
||||
system call, and some previous write failed due to insufficient
|
||||
storage space.
|
||||
.SH CONFORMING TO
|
||||
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
|
||||
.SH AVAILABILITY
|
||||
|
|
28
man2/write.2
28
man2/write.2
|
@ -47,7 +47,7 @@ write \- write to a file descriptor
|
|||
.BR write ()
|
||||
writes up to
|
||||
.I count
|
||||
bytes from the buffer pointed
|
||||
bytes from the buffer starting at
|
||||
.I buf
|
||||
to the file referred to by the file descriptor
|
||||
.IR fd .
|
||||
|
@ -181,6 +181,22 @@ or the file offset is not suitably aligned.
|
|||
.TP
|
||||
.B EIO
|
||||
A low-level I/O error occurred while modifying the inode.
|
||||
This error may relate to the write-back of data written by an
|
||||
earlier
|
||||
.BR write (2),
|
||||
which may have been issued to a different file descriptor on
|
||||
the same file. Since Linux 4.13, errors from write-back come
|
||||
with a promise that they
|
||||
.I may
|
||||
be reported by subsequent.
|
||||
.BR write (2)
|
||||
requests, and
|
||||
.I will
|
||||
be reported by a subsequent
|
||||
.BR fsync (2)
|
||||
(whether or not they were also reported by
|
||||
.BR write (2)).
|
||||
.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
|
||||
.TP
|
||||
.B ENOSPC
|
||||
The device containing the file referred to by
|
||||
|
@ -222,8 +238,14 @@ unsigned and signed integer data types specified by POSIX.1.
|
|||
A successful return from
|
||||
.BR write ()
|
||||
does not make any guarantee that data has been committed to disk.
|
||||
In fact, on some buggy implementations, it does not even guarantee
|
||||
that space has successfully been reserved for the data.
|
||||
On some filesystems, including NFS, it does not even guarantee
|
||||
that space has successfully been reserved for the data. In the case,
|
||||
some errors might be delayed to a future
|
||||
.BR write (2)
|
||||
or to
|
||||
.BR fsync (2)
|
||||
or even
|
||||
.BR close (2).
|
||||
The only way to be sure is to call
|
||||
.BR fsync (2)
|
||||
after you are done writing all your data.
|
||||
|
|
Loading…
Reference in New Issue