* [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <1505305391.4822.13.camel@redhat.com>
@ 2017-09-13 23:50 ` NeilBrown
[not found] ` <87ingm9n04.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: NeilBrown @ 2017-09-13 23:50 UTC (permalink / raw)
To: Michael Kerrisk (man-pages), Jeff Layton, Trond Myklebust,
anna.schumaker@netapp.com, jlayton@kernel.org
Cc: linux-man, linux-nfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 4344 bytes --]
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 details about ENOSPC and EDQUOT
which can be delayed in a similar manner to EIO - for NFS in particular.
Signed-off-by: NeilBrown <neilb@suse.com>
---
This is my summary of recent changes, and details that have been made
clear during the exploration of those changes.
I haven't mentioned the fact that EPERM can be returned by
write/fsync/close on NFS if the permissions on the server are changed.
We probably should ... are there other errors that are worth mentioning
along with EPERM, ENOSPC, EDQUOT ??
Thanks,
NeilBronw
man2/close.2 | 9 +++++++++
man2/fsync.2 | 19 ++++++++++++++++++-
man2/write.2 | 20 +++++++++++++++++---
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/man2/close.2 b/man2/close.2
index 751ec322b1f1..9776c839b8b6 100644
--- a/man2/close.2
+++ b/man2/close.2
@@ -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 ()
diff --git a/man2/fsync.2 b/man2/fsync.2
index f1a01301da0f..e706a08d360d 100644
--- a/man2/fsync.2
+++ b/man2/fsync.2
@@ -120,12 +120,29 @@ 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, and which are still open. 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 on the same
+file.
.TP
.BR EROFS ", " EINVAL
.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
diff --git a/man2/write.2 b/man2/write.2
index 6a39b5b5541d..1a9a86b03b04 100644
--- a/man2/write.2
+++ b/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,14 @@ 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 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 will
+be reported to all file descriptors that might have
+written the data which triggered the error, and which are still
+open.
+.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
.TP
.B ENOSPC
The device containing the file referred to by
@@ -222,8 +230,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.
--
2.14.0.rc0.dirty
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <87ingm9n04.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
@ 2017-09-14 7:59 ` walter harms
[not found] ` <59BA36C5.9000506-fPG8STNUNVg@public.gmane.org>
2017-09-14 10:48 ` Jeff Layton
1 sibling, 1 reply; 9+ messages in thread
From: walter harms @ 2017-09-14 7:59 UTC (permalink / raw)
To: NeilBrown; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Am 14.09.2017 01:50, schrieb NeilBrown:
>
> 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 details about ENOSPC and EDQUOT
> which can be delayed in a similar manner to EIO - for NFS in particular.
>
I never read EDQUOT before but it is real:
see:
http://elixir.free-electrons.com/linux/latest/source/security/keys/request_key.c
-EDQUOT
* if insufficient key quota was available to create a new key
> Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
> ---
>
> This is my summary of recent changes, and details that have been made
> clear during the exploration of those changes.
>
> I haven't mentioned the fact that EPERM can be returned by
> write/fsync/close on NFS if the permissions on the server are changed.
> We probably should ... are there other errors that are worth mentioning
> along with EPERM, ENOSPC, EDQUOT ??
>
> Thanks,
> NeilBronw
>
>
> man2/close.2 | 9 +++++++++
> man2/fsync.2 | 19 ++++++++++++++++++-
> man2/write.2 | 20 +++++++++++++++++---
> 3 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/man2/close.2 b/man2/close.2
> index 751ec322b1f1..9776c839b8b6 100644
> --- a/man2/close.2
> +++ b/man2/close.2
> @@ -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 ()
> diff --git a/man2/fsync.2 b/man2/fsync.2
> index f1a01301da0f..e706a08d360d 100644
> --- a/man2/fsync.2
> +++ b/man2/fsync.2
> @@ -120,12 +120,29 @@ 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, and which are still open. 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 on the same
> +file.
> .TP
> .BR EROFS ", " EINVAL
> .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
> diff --git a/man2/write.2 b/man2/write.2
> index 6a39b5b5541d..1a9a86b03b04 100644
> --- a/man2/write.2
> +++ b/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,14 @@ 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 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 will
> +be reported to all file descriptors that might have
> +written the data which triggered the error, and which are still
> +open.
> +.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
> .TP
> .B ENOSPC
> The device containing the file referred to by
> @@ -222,8 +230,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.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <87ingm9n04.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2017-09-14 7:59 ` walter harms
@ 2017-09-14 10:48 ` Jeff Layton
2017-09-15 7:50 ` Michael Kerrisk (man-pages)
[not found] ` <1505386139.4870.10.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
1 sibling, 2 replies; 9+ messages in thread
From: Jeff Layton @ 2017-09-14 10:48 UTC (permalink / raw)
To: NeilBrown, Michael Kerrisk (man-pages), Trond Myklebust,
anna.schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org,
jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Thu, 2017-09-14 at 09:50 +1000, NeilBrown wrote:
> 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 details about ENOSPC and EDQUOT
> which can be delayed in a similar manner to EIO - for NFS in particular.
>
> Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
> ---
>
> This is my summary of recent changes, and details that have been made
> clear during the exploration of those changes.
>
> I haven't mentioned the fact that EPERM can be returned by
> write/fsync/close on NFS if the permissions on the server are changed.
> We probably should ... are there other errors that are worth mentioning
> along with EPERM, ENOSPC, EDQUOT ??
>
> Thanks,
> NeilBronw
>
Many thanks for doing this! It was on my to-do list. Comments below:
>
> man2/close.2 | 9 +++++++++
> man2/fsync.2 | 19 ++++++++++++++++++-
> man2/write.2 | 20 +++++++++++++++++---
> 3 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/man2/close.2 b/man2/close.2
> index 751ec322b1f1..9776c839b8b6 100644
> --- a/man2/close.2
> +++ b/man2/close.2
> @@ -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 ()
> diff --git a/man2/fsync.2 b/man2/fsync.2
> index f1a01301da0f..e706a08d360d 100644
> --- a/man2/fsync.2
> +++ b/man2/fsync.2
> @@ -120,12 +120,29 @@ 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, and which are still open.
This is a little awkward. How could we report to a fd that was no longer
open? How about:
"Since Linux 4.13, errors from write-back will be reported to all file
descriptors that were open at the time that the error was recorded."
> 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 on the same
> +file.
> .TP
> .BR EROFS ", " EINVAL
> .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
> diff --git a/man2/write.2 b/man2/write.2
> index 6a39b5b5541d..1a9a86b03b04 100644
> --- a/man2/write.2
> +++ b/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,14 @@ 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 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 will
> +be reported to all file descriptors that might have
> +written the data which triggered the error, and which are still
> +open.
This is where things get a little more vague.
Some filesystems will return errors on a subsequent write(2) when
previous writeback has failed -- some don't. In either case though,
write(2) should never advance your errseq_t cursor, so only an fsync
will "clear" an earlier error.
I'm not sure how best to convey that in the manpages though.
> +.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
> .TP
> .B ENOSPC
> The device containing the file referred to by
> @@ -222,8 +230,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.
--
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <59BA36C5.9000506-fPG8STNUNVg@public.gmane.org>
@ 2017-09-14 22:36 ` NeilBrown
0 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2017-09-14 22:36 UTC (permalink / raw)
To: wharms-fPG8STNUNVg; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
On Thu, Sep 14 2017, walter harms wrote:
> Am 14.09.2017 01:50, schrieb NeilBrown:
>>
>> 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 details about ENOSPC and EDQUOT
>> which can be delayed in a similar manner to EIO - for NFS in particular.
>>
>
> I never read EDQUOT before but it is real:
>
> see:
> http://elixir.free-electrons.com/linux/latest/source/security/keys/request_key.c
>
> -EDQUOT
> * if insufficient key quota was available to create a new key
EDQUOT existed long before security keys.
It's original purpose is to report Disk QUOTa problems. If you write to
a file and you have exhausted you quota, you get EDQUOT.
http://elixir.free-electrons.com/linux/latest/source/fs/quota/dquot.c#L1318
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
2017-09-14 10:48 ` Jeff Layton
@ 2017-09-15 7:50 ` Michael Kerrisk (man-pages)
[not found] ` <28da8888-e8f9-31d5-a3dd-d3c2a5e9037a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[not found] ` <1505386139.4870.10.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-09-15 7:50 UTC (permalink / raw)
To: Jeff Layton, NeilBrown, Trond Myklebust,
anna.schumaker@netapp.com, jlayton@kernel.org
Cc: mtk.manpages, linux-man, linux-nfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Hi Neil,
Will you revise this patch to incorporate Jeff's comments, or
should I try manually editing them in. (I'd prefer the former.)
Cheers,
Michael
On 09/14/2017 12:48 PM, Jeff Layton wrote:
> On Thu, 2017-09-14 at 09:50 +1000, NeilBrown wrote:
>> 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 details about ENOSPC and EDQUOT
>> which can be delayed in a similar manner to EIO - for NFS in particular.
>>
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>
>> This is my summary of recent changes, and details that have been made
>> clear during the exploration of those changes.
>>
>> I haven't mentioned the fact that EPERM can be returned by
>> write/fsync/close on NFS if the permissions on the server are changed.
>> We probably should ... are there other errors that are worth mentioning
>> along with EPERM, ENOSPC, EDQUOT ??
>>
>> Thanks,
>> NeilBronw
>>
>
> Many thanks for doing this! It was on my to-do list. Comments below:
>
>>
>> man2/close.2 | 9 +++++++++
>> man2/fsync.2 | 19 ++++++++++++++++++-
>> man2/write.2 | 20 +++++++++++++++++---
>> 3 files changed, 44 insertions(+), 4 deletions(-)
>>
>> diff --git a/man2/close.2 b/man2/close.2
>> index 751ec322b1f1..9776c839b8b6 100644
>> --- a/man2/close.2
>> +++ b/man2/close.2
>> @@ -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 ()
>> diff --git a/man2/fsync.2 b/man2/fsync.2
>> index f1a01301da0f..e706a08d360d 100644
>> --- a/man2/fsync.2
>> +++ b/man2/fsync.2
>> @@ -120,12 +120,29 @@ 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, and which are still open.
>
> This is a little awkward. How could we report to a fd that was no longer
> open? How about:
>
> "Since Linux 4.13, errors from write-back will be reported to all file
> descriptors that were open at the time that the error was recorded."
>
>> 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 on the same
>> +file.
>> .TP
>> .BR EROFS ", " EINVAL
>> .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
>> diff --git a/man2/write.2 b/man2/write.2
>> index 6a39b5b5541d..1a9a86b03b04 100644
>> --- a/man2/write.2
>> +++ b/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,14 @@ 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 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 will
>> +be reported to all file descriptors that might have
>> +written the data which triggered the error, and which are still
>> +open.
>
>
> This is where things get a little more vague.
>
> Some filesystems will return errors on a subsequent write(2) when
> previous writeback has failed -- some don't. In either case though,
> write(2) should never advance your errseq_t cursor, so only an fsync
> will "clear" an earlier error.
>
> I'm not sure how best to convey that in the manpages though.
>
>> +.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
>> .TP
>> .B ENOSPC
>> The device containing the file referred to by
>> @@ -222,8 +230,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.
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <28da8888-e8f9-31d5-a3dd-d3c2a5e9037a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-15 8:25 ` NeilBrown
0 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2017-09-15 8:25 UTC (permalink / raw)
To: Jeff Layton, Trond Myklebust, anna.schumaker@netapp.com,
jlayton@kernel.org
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
linux-man-u79uwXL29TY76Z2rM5mHXA, linux-nfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 6221 bytes --]
I'll do something, but maybe not for a few days (24 hour sardine
impersonation pending - Europe, here I come...)
NeilBrown
On Fri, Sep 15 2017, Michael Kerrisk (man-pages) wrote:
> Hi Neil,
>
> Will you revise this patch to incorporate Jeff's comments, or
> should I try manually editing them in. (I'd prefer the former.)
>
> Cheers,
>
> Michael
>
>
> On 09/14/2017 12:48 PM, Jeff Layton wrote:
>> On Thu, 2017-09-14 at 09:50 +1000, NeilBrown wrote:
>>> 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 details about ENOSPC and EDQUOT
>>> which can be delayed in a similar manner to EIO - for NFS in particular.
>>>
>>> Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
>>> ---
>>>
>>> This is my summary of recent changes, and details that have been made
>>> clear during the exploration of those changes.
>>>
>>> I haven't mentioned the fact that EPERM can be returned by
>>> write/fsync/close on NFS if the permissions on the server are changed.
>>> We probably should ... are there other errors that are worth mentioning
>>> along with EPERM, ENOSPC, EDQUOT ??
>>>
>>> Thanks,
>>> NeilBronw
>>>
>>
>> Many thanks for doing this! It was on my to-do list. Comments below:
>>
>>>
>>> man2/close.2 | 9 +++++++++
>>> man2/fsync.2 | 19 ++++++++++++++++++-
>>> man2/write.2 | 20 +++++++++++++++++---
>>> 3 files changed, 44 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/man2/close.2 b/man2/close.2
>>> index 751ec322b1f1..9776c839b8b6 100644
>>> --- a/man2/close.2
>>> +++ b/man2/close.2
>>> @@ -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 ()
>>> diff --git a/man2/fsync.2 b/man2/fsync.2
>>> index f1a01301da0f..e706a08d360d 100644
>>> --- a/man2/fsync.2
>>> +++ b/man2/fsync.2
>>> @@ -120,12 +120,29 @@ 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, and which are still open.
>>
>> This is a little awkward. How could we report to a fd that was no longer
>> open? How about:
>>
>> "Since Linux 4.13, errors from write-back will be reported to all file
>> descriptors that were open at the time that the error was recorded."
>>
>>> 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 on the same
>>> +file.
>>> .TP
>>> .BR EROFS ", " EINVAL
>>> .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
>>> diff --git a/man2/write.2 b/man2/write.2
>>> index 6a39b5b5541d..1a9a86b03b04 100644
>>> --- a/man2/write.2
>>> +++ b/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,14 @@ 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 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 will
>>> +be reported to all file descriptors that might have
>>> +written the data which triggered the error, and which are still
>>> +open.
>>
>>
>> This is where things get a little more vague.
>>
>> Some filesystems will return errors on a subsequent write(2) when
>> previous writeback has failed -- some don't. In either case though,
>> write(2) should never advance your errseq_t cursor, so only an fsync
>> will "clear" an earlier error.
>>
>> I'm not sure how best to convey that in the manpages though.
>>
>>> +.\" commit 088737f44bbf6378745f5b57b035e57ee3dc4750
>>> .TP
>>> .B ENOSPC
>>> The device containing the file referred to by
>>> @@ -222,8 +230,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.
>>
>
>
> --
> Michael Kerrisk
> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
> Linux/UNIX System Programming Training: http://man7.org/training/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <1505386139.4870.10.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-09-28 3:01 ` NeilBrown
[not found] ` <87fub75xxr.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2017-09-28 16:19 ` Michael Kerrisk (man-opages)
0 siblings, 2 replies; 9+ messages in thread
From: NeilBrown @ 2017-09-28 3:01 UTC (permalink / raw)
To: Jeff Layton, Michael Kerrisk (man-pages), Trond Myklebust,
anna.schumaker@netapp.com, jlayton@kernel.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, linux-nfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 7187 bytes --]
On Thu, Sep 14 2017, Jeff Layton wrote:
>> .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, and which are still open.
>
> This is a little awkward. How could we report to a fd that was no longer
> open? How about:
>
> "Since Linux 4.13, errors from write-back will be reported to all file
> descriptors that were open at the time that the error was recorded."
That might be simpler, but it is less correct. As I go on to say, NFS
*doesn't* report on all file descriptors that were open at that time.
I've changed it to
-------------------
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 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.
------------------
which includes some of your text, and removes the "that are still open"
which probably doesn't help.
>> .TP
>> .B EIO
>> A low-level I/O error occurred while modifying the inode.
>> +This error may relate to 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 will
>> +be reported to all file descriptors that might have
>> +written the data which triggered the error, and which are still
>> +open.
>
>
> This is where things get a little more vague.
>
> Some filesystems will return errors on a subsequent write(2) when
> previous writeback has failed -- some don't. In either case though,
> write(2) should never advance your errseq_t cursor, so only an fsync
> will "clear" an earlier error.
>
> I'm not sure how best to convey that in the manpages though.
How about:
-------------
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)).
------------
??
Those changes are included in the following.
Thanks,
NeilBrown
From: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
Date: Thu, 14 Sep 2017 09:44:43 +1000
Subject: [PATCH] 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.
Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
---
man2/close.2 | 9 +++++++++
man2/fsync.2 | 18 +++++++++++++++++-
man2/write.2 | 28 +++++++++++++++++++++++++---
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/man2/close.2 b/man2/close.2
index 55d89ed3dbc7..136bd0be3f67 100644
--- a/man2/close.2
+++ b/man2/close.2
@@ -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 ()
diff --git a/man2/fsync.2 b/man2/fsync.2
index eed3c460bea9..c7878bf3496f 100644
--- a/man2/fsync.2
+++ b/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
diff --git a/man2/write.2 b/man2/write.2
index 061aa70cf590..b1cc3a2cfb17 100644
--- a/man2/write.2
+++ b/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.
--
2.14.0.rc0.dirty
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
[not found] ` <87fub75xxr.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
@ 2017-09-28 12:20 ` Jeff Layton
0 siblings, 0 replies; 9+ messages in thread
From: Jeff Layton @ 2017-09-28 12:20 UTC (permalink / raw)
To: NeilBrown, Michael Kerrisk (man-pages), Trond Myklebust,
anna.schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org,
jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Thu, 2017-09-28 at 13:01 +1000, NeilBrown wrote:
> On Thu, Sep 14 2017, Jeff Layton wrote:
>
> > > .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, and which are still open.
> >
> > This is a little awkward. How could we report to a fd that was no
> > longer
> > open? How about:
> >
> > "Since Linux 4.13, errors from write-back will be reported to all
> > file
> > descriptors that were open at the time that the error was
> > recorded."
>
> That might be simpler, but it is less correct. As I go on to say,
> NFS
> *doesn't* report on all file descriptors that were open at that time.
>
> I've changed it to
>
> -------------------
> 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 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.
> ------------------
>
> which includes some of your text, and removes the "that are still
> open"
> which probably doesn't help.
>
> > > .TP
> > > .B EIO
> > > A low-level I/O error occurred while modifying the inode.
> > > +This error may relate to 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 will
> > > +be reported to all file descriptors that might have
> > > +written the data which triggered the error, and which are still
> > > +open.
> >
> >
> > This is where things get a little more vague.
> >
> > Some filesystems will return errors on a subsequent write(2) when
> > previous writeback has failed -- some don't. In either case though,
> > write(2) should never advance your errseq_t cursor, so only an
> > fsync
> > will "clear" an earlier error.
> >
> > I'm not sure how best to convey that in the manpages though.
>
> How about:
>
> -------------
> 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)).
> ------------
> ??
>
> Those changes are included in the following.
>
> Thanks,
> NeilBrown
>
> From: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
> Date: Thu, 14 Sep 2017 09:44:43 +1000
> Subject: [PATCH] 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.
>
> Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
> ---
> man2/close.2 | 9 +++++++++
> man2/fsync.2 | 18 +++++++++++++++++-
> man2/write.2 | 28 +++++++++++++++++++++++++---
> 3 files changed, 51 insertions(+), 4 deletions(-)
>
> diff --git a/man2/close.2 b/man2/close.2
> index 55d89ed3dbc7..136bd0be3f67 100644
> --- a/man2/close.2
> +++ b/man2/close.2
> @@ -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 ()
> diff --git a/man2/fsync.2 b/man2/fsync.2
> index eed3c460bea9..c7878bf3496f 100644
> --- a/man2/fsync.2
> +++ b/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
> diff --git a/man2/write.2 b/man2/write.2
> index 061aa70cf590..b1cc3a2cfb17 100644
> --- a/man2/write.2
> +++ b/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.
Looks good to me!
Reviewed-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes
2017-09-28 3:01 ` NeilBrown
[not found] ` <87fub75xxr.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
@ 2017-09-28 16:19 ` Michael Kerrisk (man-opages)
1 sibling, 0 replies; 9+ messages in thread
From: Michael Kerrisk (man-opages) @ 2017-09-28 16:19 UTC (permalink / raw)
To: NeilBrown, Jeff Layton, Trond Myklebust,
anna.schumaker@netapp.com, jlayton@kernel.org
Cc: mtk.manpages, linux-man, linux-nfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Hi Neil,
On 09/28/2017 05:01 AM, NeilBrown wrote:
> On Thu, Sep 14 2017, Jeff Layton wrote:
>
>>> .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, and which are still open.
>>
>> This is a little awkward. How could we report to a fd that was no longer
>> open? How about:
>>
>> "Since Linux 4.13, errors from write-back will be reported to all file
>> descriptors that were open at the time that the error was recorded."
>
> That might be simpler, but it is less correct. As I go on to say, NFS
> *doesn't* report on all file descriptors that were open at that time.
>
> I've changed it to
>
> -------------------
> 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 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.
> ------------------
>
> which includes some of your text, and removes the "that are still open"
> which probably doesn't help.
>
>>> .TP
>>> .B EIO
>>> A low-level I/O error occurred while modifying the inode.
>>> +This error may relate to 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 will
>>> +be reported to all file descriptors that might have
>>> +written the data which triggered the error, and which are still
>>> +open.
>>
>>
>> This is where things get a little more vague.
>>
>> Some filesystems will return errors on a subsequent write(2) when
>> previous writeback has failed -- some don't. In either case though,
>> write(2) should never advance your errseq_t cursor, so only an fsync
>> will "clear" an earlier error.
>>
>> I'm not sure how best to convey that in the manpages though.
>
> How about:
>
> -------------
> 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)).
> ------------
> ??
>
> Those changes are included in the following.
>
> Thanks,
> NeilBrown
>
> From: NeilBrown <neilb@suse.com>
> Date: Thu, 14 Sep 2017 09:44:43 +1000
> Subject: [PATCH] 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.
>
> Signed-off-by: NeilBrown <neilb@suse.com>
Thanks! I've applied, and added Jeff's Reviewed-by.
Cheers,
Michael
> ---
> man2/close.2 | 9 +++++++++
> man2/fsync.2 | 18 +++++++++++++++++-
> man2/write.2 | 28 +++++++++++++++++++++++++---
> 3 files changed, 51 insertions(+), 4 deletions(-)
>
> diff --git a/man2/close.2 b/man2/close.2
> index 55d89ed3dbc7..136bd0be3f67 100644
> --- a/man2/close.2
> +++ b/man2/close.2
> @@ -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 ()
> diff --git a/man2/fsync.2 b/man2/fsync.2
> index eed3c460bea9..c7878bf3496f 100644
> --- a/man2/fsync.2
> +++ b/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
> diff --git a/man2/write.2 b/man2/write.2
> index 061aa70cf590..b1cc3a2cfb17 100644
> --- a/man2/write.2
> +++ b/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.
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-28 16:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170720194227.7830-1-jlayton@kernel.org>
[not found] ` <1503683981.22608.0.camel@redhat.com>
[not found] ` <87h8wsiog4.fsf@notabene.neil.brown.name>
[not found] ` <1503920855.4563.12.camel@redhat.com>
[not found] ` <87pobfgo9q.fsf@notabene.neil.brown.name>
[not found] ` <1504004058.4679.7.camel@redhat.com>
[not found] ` <87efrjb2mn.fsf@notabene.neil.brown.name>
[not found] ` <1504784132.4954.12.camel@redhat.com>
[not found] ` <1504796087.3561.7.camel@primarydata.com>
[not found] ` <874ls9diij.fsf@notabene.neil.brown.name>
[not found] ` <1505126785.4916.7.camel@redhat.com>
[not found] ` <87poawc390.fsf@notabene.neil.brown.name>
[not found] ` <1505229616.28831.26.camel@redhat.com>
[not found] ` <87efrbbne1.fsf@notabene.neil.brown.name>
[not found] ` <1505305391.4822.13.camel@redhat.com>
2017-09-13 23:50 ` [RFC PATCH manpages] write.2, fsync.2, close.2: update description of error codes NeilBrown
[not found] ` <87ingm9n04.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2017-09-14 7:59 ` walter harms
[not found] ` <59BA36C5.9000506-fPG8STNUNVg@public.gmane.org>
2017-09-14 22:36 ` NeilBrown
2017-09-14 10:48 ` Jeff Layton
2017-09-15 7:50 ` Michael Kerrisk (man-pages)
[not found] ` <28da8888-e8f9-31d5-a3dd-d3c2a5e9037a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-15 8:25 ` NeilBrown
[not found] ` <1505386139.4870.10.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-09-28 3:01 ` NeilBrown
[not found] ` <87fub75xxr.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2017-09-28 12:20 ` Jeff Layton
2017-09-28 16:19 ` Michael Kerrisk (man-opages)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).