Skip to contentSkip to conversation

erofs-utils: tests: check SEEK_HOLE/SEEK_DATA in inode_share mode

PATCH New Jingbo Xu 1 participant 1 message Sep 9

lore
Share & tools
lore

Jingbo Xu

author
#0 lore raw

PATCH v2 1/1 erofs-utils: tests: check SEEK_HOLE/SEEK_DATA in inode_share mode

In inode_share mode erofs_ishare_fops used to fall back to generic_file_llseek(), which considers the whole file to be data, so SEEK_HOLE always returned i_size and the real holes of sparse files were hidden. This is fixed by kernel commit 8ebf95897885 ("erofs:
support SEEK_HOLE/SEEK_DATA in inode_share mode").

Add a regression test for it.

---
changes since v1:
- add a minimal util probing SEEK_HOLE/SEEK_DATA, rather than relying on xfs_io

---
 tests/Makefile.am     |   3 +
 tests/erofs/033       | 151 ++++++++++++++++++++++++++++++++++++++++++
 tests/erofs/033.out   |   2 +
 tests/src/Makefile.am |   5 +-
 tests/src/lseek.c     |  65 ++++++++++++++++++
 5 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100755 tests/erofs/033
 create mode 100644 tests/erofs/033.out
 create mode 100644 tests/src/lseek.c
tests/Makefile.am +3 -0
index 363b93dc..b60a6cc9 100644
@@ -135,6 +135,9 @@ TESTS += erofs/031
 # 032 - check that the xattr layout does not depend on listxattr(2) order
 TESTS += erofs/032
 
+# 033 - regression test for SEEK_HOLE/SEEK_DATA in inode_share mode
+TESTS += erofs/033
+
 # NEW TEST CASE HERE
 # TESTS += erofs/999
 
tests/erofs/033 new file +151 -0

151 lines not on this page · raw message

tests/erofs/033.out new file +2 -0
new file mode 100644
index 00000000..c5d29149
@@ -0,0 +1,2 @@
+QA output created by 033
+Silence is golden
tests/src/Makefile.am +4 -1
index 16de41a1..4d9975e0 100644
@@ -3,12 +3,15 @@
 
 AUTOMAKE_OPTIONS	= foreign
 check_PROGRAMS		=
-noinst_PROGRAMS		= fssum
+noinst_PROGRAMS	= fssum lseek
 
 fssum_CFLAGS = -Wall -I$(top_srcdir)/include
 fssum_LDADD = $(top_builddir)/lib/liberofs.la
 fssum_SOURCES = fssum.c
 
+lseek_CFLAGS = -Wall
+lseek_SOURCES = lseek.c
+
 if ENABLE_LZ4
 check_PROGRAMS += badlz4
 badlz4_SOURCES = badlz4.c
tests/src/lseek.c new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.19.1.6.gb485710b