Add generated flag to filesystem struct to block copy_file_range
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest6 patches 36 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | fs: Add flag to file_system_type to indicate content is generatedinclude/ | +1 | 129 replies | |
| 2/6 | proc: Add FS_GENERATED_CONTENT to filesystem flagsfs/ | +1 | 0 replies | |
| 3/6 | sysfs: Add FS_GENERATED_CONTENT to filesystem flagsfs/ | +1 | 0 replies | |
| 4/6 | debugfs: Add FS_GENERATED_CONTENT to filesystem flagsfs/ | +1 | 0 replies | |
| 5/6 | tracefs: Add FS_GENERATED_CONTENT to filesystem flagsfs/ | +1 | 1 reply | |
| 6/6 | vfs: Disallow copy_file_range on generated file systemsfs/ | +3 | 3 replies |
Reviews trailers per patch
2 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Steven Rostedt (VMware) | Amir Goldstein | Nicolas Boichat | Christoph Hellwig |
|---|---|---|---|---|
| 1/6 | R-b R-b | T-b T-b T-b | R-b | |
| 2/6 | ||||
| 3/6 | ||||
| 4/6 | ||||
| 5/6 | A-b | |||
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH 0/6] Add generated flag to filesystem struct to block copy_file_range
We hit an issue when upgrading Go compiler from 1.13 to 1.15 [1], as we use Go's io.Copy to copy the content of /sys/kernel/debug/tracing/trace to a temporary file.
Under the hood, Go 1.15 uses copy_file_range syscall to optimize the copy operation. However, that fails to copy any content when the input file is from tracefs, with an apparent size of 0 (but there is still content when you cat it, of course).
From discussions in [2][3], it is clear that copy_file_range cannot be properly implemented on filesystems where the content is generated at runtime: the file size is incorrect (because it is unknown before the content is generated), and seeking in such files (as required by partial writes) is unlikely to work correctly.
With this patch, Go's io.Copy gracefully falls back to a normal read/write file copy.
I'm not 100% sure which stable tree this should go in, I'd say at least >=5.3 since this is what introduced support for cross-filesystem copy_file_range (and where most users are somewhat likely to hit this issue). But let's discuss the patch series first.
[1] http://issuetracker.google.com/issues/178332739
[2] https://lkml.org/lkml/2021/1/25/64
[3] https://lkml.org/lkml/2021/1/26/1736
Nicolas Boichat (6):
fs: Add flag to file_system_type to indicate content is generated
proc: Add FS_GENERATED_CONTENT to filesystem flags
sysfs: Add FS_GENERATED_CONTENT to filesystem flags
debugfs: Add FS_GENERATED_CONTENT to filesystem flags
tracefs: Add FS_GENERATED_CONTENT to filesystem flags
vfs: Disallow copy_file_range on generated file systems
fs/debugfs/inode.c | 1 + fs/proc/root.c | 2 +- fs/read_write.c | 3 +++ fs/sysfs/mount.c | 2 +- fs/tracefs/inode.c | 1 + include/linux/fs.h | 1 + 6 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.0.478.g8a0d178c01-goog