sync_file_range.2: add some big WARNINGS
This system call is by design completely unsuitable for any data integrity operations. Make that very clear in the manpage.
man2/sync_file_range.2 +15 -4
@@ -80,11 +80,22 @@ after performing any write. Specifying .I flags as 0 is permitted, as a no-op. -.SS Some details -None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. None of these operations write out the file's metadata. Therefore, unless the application is strictly performing overwrites of -already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs +an over write of existing allocated blocks is impossible. Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some details .B SYNC_FILE_RANGE_WAIT_BEFORE and
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Christoph,
Thanks for this patch. Since Andrew was the original author of this syscall, I'd like him to take a look at these changes, to get some review.
Andrew?
Thanks
Michael
Quoted 38 lines · Christoph Hellwig
This system call is by design completely unsuitable for any data integrity operations. Make that very clear in the manpage.
Signed-off-by Christoph Hellwig <[email protected]>Index: man-pages/man2/sync_file_range.2
===================================================================man2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +0
-0@@ -80,11 +80,22 @@ after performing any write.Specifying
.I flags
as 0 is permitted, as a no-op.
-.SS Some detailsman2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +3
-1-None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. None of these operations write out the file's metadata.Therefore, unless the application is strictly performing overwrites of
man2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +12
-2-already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs +an over write of existing allocated blocks is impossible. Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some details.B
SYNC_FILE_RANGE_WAIT_BEFORE
and
Signature · 8 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Watch my Linux system programming book progress to publication! http://blog.man7.org/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 40 lines · On Sun, 20 Sep 2009 07:34:40 +0200 Michael Kerrisk…
Hi Christoph,
Thanks for this patch. Since Andrew was the original author of this syscall, I'd like him to take a look at these changes, to get some review.
Andrew?
Thanks
Michael
Quoted 27 lines · Christoph Hellwig
This system call is by design completely unsuitable for any data integrity operations.
__Makethat very clear in the manpage.Signed-off-by Christoph Hellwig <[email protected]>Index: man-pages/man2/sync_file_range.2
===================================================================man2/sync_file_range.2 __ __2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 __ __ __ 2009-08-27 14:51:51.373360594 -0300 +0
-0@@ -80,11 +80,22 @@ after performing any write.
__Specifying
__.I flags__as0 is permitted, as a no-op.
-.SS Some detailsman2/sync_file_range.2 __ __2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 __ __ __ 2009-08-27 14:51:51.373360594 -0300 +3
-1-None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. __None of these operations write out the file's metadata.
__Therefore, unless the application is strictly performing overwrites ofman2/sync_file_range.2 __ __2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 __ __ __ 2009-08-27 14:51:51.373360594 -0300 +5
-2-already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. __There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs
Quoted 8 lines
man2/sync_file_range.2 __ __2009-08-27 14:57:35.213854927 -0300
Quoted 8 lines
man2/sync_file_range.2 __ __2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 __ __ __ 2009-08-27 14:51:51.373360594 -0300 +7
-0+an over write of existing allocated blocks is impossible. __Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some details
Shrug. If you want.
The syscall is all about dirty memory management and userspace control over IO timing/volume. Trying to use it for data integrity purposes is a bit perverse.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Andrew Morton
The syscall is all about dirty memory management and userspace control over IO timing/volume. Trying to use it for data integrity purposes is a bit perverse.
Yes, its is. But that needs to be clearly documented. If you have better wording to make it crystal clear you're welcome.
Additionally I have a half-backed patch to allow it calling into ->fsync to actually make it usable as a fdatasync_range/fsync_range, but I wonder if we should just add those as syscalls instead.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · On Tue, 22 Sep 2009 13:40:52 +0200 Christoph Hellwig…
Quoted 3 lines · Andrew Morton
The syscall is all about dirty memory management and userspace control over IO timing/volume. Trying to use it for data integrity purposes is a bit perverse.
Yes, its is. But that needs to be clearly documented. If you have better wording to make it crystal clear you're welcome.
Additionally I have a half-backed patch to allow it calling into ->fsync to actually make it usable as a fdatasync_range/fsync_range, but I wonder if we should just add those as syscalls instead.
hm, hard call.
I guess we should avoid permitting people to sync the metadata before the data, because that would provide an easy way to expose huge amounts of unwritten blocks if the machine crashes at the right time. Or perhaps it's not worth bothering about that.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
So what are we going to do with it? The current manpage still suggests it might actuall be safe for overwrites which it really isn't.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
ping?
Quoted 27 lines · Christoph Hellwig
This system call is by design completely unsuitable for any data integrity operations. Make that very clear in the manpage.
Signed-off-by Christoph Hellwig <[email protected]>Index: man-pages/man2/sync_file_range.2
===================================================================man2/sync_file_range.2 +8
-4@@ -80,11 +80,22 @@ after performing any write. Specifying .I flags as 0 is permitted, as a no-op. -.SS Some details -None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. None of these operations write out the file's metadata. Therefore, unless the application is strictly performing overwrites of -already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs
man2/sync_file_range.2 after performing any write. · line 101
Quoted 10 lines
man2/sync_file_range.2 +7
-0+an over write of existing allocated blocks is impossible. Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some details .B SYNC_FILE_RANGE_WAIT_BEFORE and
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Are you going to put this or some equivalent note in? Currently the
manpages is extremly dangerous as it doesn't warn people about this system call not actually guaranteeing any data integrity.
Quoted 27 lines · Christoph Hellwig
This system call is by design completely unsuitable for any data integrity operations. Make that very clear in the manpage.
Signed-off-by Christoph Hellwig <[email protected]>Index: man-pages/man2/sync_file_range.2
===================================================================man2/sync_file_range.2 +8
-4@@ -80,11 +80,22 @@ after performing any write. Specifying .I flags as 0 is permitted, as a no-op. -.SS Some details -None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. None of these operations write out the file's metadata. Therefore, unless the application is strictly performing overwrites of -already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs
man2/sync_file_range.2 after performing any write. · line 101
Quoted 10 lines
man2/sync_file_range.2 +7
-0+an over write of existing allocated blocks is impossible. Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some details .B SYNC_FILE_RANGE_WAIT_BEFORE and
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Christoph,
Quoted 3 lines · Christoph Hellwig
Are you going to put this or some equivalent note in? Currently the manpages is extremly dangerous as it doesn't warn people about this system call not actually guaranteeing any data integrity.
I lightly edited your patch, and applied it. Sorry for the long delay.
Cheers,
Michael
Quoted 40 lines · Christoph Hellwig
Quoted 35 lines
This system call is by design completely unsuitable for any data integrity operations. Make that very clear in the manpage.
Signed-off-by Christoph Hellwig <[email protected]>Index: man-pages/man2/sync_file_range.2
===================================================================man2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +0
-0@@ -80,11 +80,22 @@ after performing any write.Specifying
.I flags
as 0 is permitted, as a no-op.
-.SS Some detailsman2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +3
-1-None of these operations write out the file's metadata. +.SS WARNING +This system call is extremly dangerous and should not be used in portable +programs. None of these operations write out the file's metadata.Therefore, unless the application is strictly performing overwrites of
man2/sync_file_range.2 2009-08-27 14:57:35.213854927 -0300 renamed from man2/sync_file_range.2 2009-08-27 14:51:51.373360594 -0300 +12
-2-already-instantiated disk blocks, -there are no guarantees that the data will be available after a crash. +already-instantiated disk blocks, there are no guarantees that the data will +be available after a crash. There is no user interface to know if a +write is purely an overwrite. On filesystem using copy on write semantics +like +.IR btrfs +an over write of existing allocated blocks is impossible. Writing into +pre-allocated space many filesystems also require calls into the block +allocator which this system call does not sync out to disk. +This system call does not flush disk write caches and thus does not provide +any data integrity on systems with volatile disk write caches. + +.SS Some detailsQuoted 2 lines
.B
SYNC_FILE_RANGE_WAIT_BEFORE
and---end quoted text---
Signature · 7 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface" http://blog.man7.org/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Michael Kerrisk
Hi Christoph,
Quoted 3 lines · Christoph Hellwig
Are you going to put this or some equivalent note in? ? Currently the manpages is extremly dangerous as it doesn't warn people about this system call not actually guaranteeing any data integrity.
I lightly edited your patch, and applied it. Sorry for the long delay.
Thanks a lot!
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html