From de198f2d9507b6dcf3d0d8f037ba33940208733e Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sun, 7 Nov 2021 13:27:44 -0800 Subject: Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency When using lseek(2) to report data/holes memory mapped regions of the file were ignored. This could result in incorrect results. To handle this zfs_holey_common() was updated to asynchronously writeback any dirty mmap(2) regions prior to reporting holes. Additionally, while not strictly required, the dn_struct_rwlock is now held over the dirty check to prevent the dnode structure from changing. This ensures that a clean dnode can't be dirtied before the data/hole is located. The range lock is now also taken to ensure the call cannot race with zfs_write(). Furthermore, the code was refactored to provide a dnode_is_dirty() helper function which checks the dnode for any dirty records to determine its dirtiness. Reviewed-by: Matthew Ahrens Reviewed-by: Tony Hutter Reviewed-by: Rich Ercolani Signed-off-by: Brian Behlendorf Issue #11900 Closes #12724 --- tests/runfiles/common.run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/runfiles/common.run') diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 7f7d161be..9f181b53e 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -675,7 +675,7 @@ tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos', tags = ['functional', 'migration'] [tests/functional/mmap] -tests = ['mmap_write_001_pos', 'mmap_read_001_pos'] +tests = ['mmap_write_001_pos', 'mmap_read_001_pos', 'mmap_seek_001_pos'] tags = ['functional', 'mmap'] [tests/functional/mount] -- cgit v1.2.3