]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
fuzzy: don't use readarray for xfsfind output
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:30 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
commit040e74c891922424519060095d1d322977cde50a
treef4e73043b47dfd75ad9c233b6f821ac51bca3967
parentb816737426bf21117d6a9dd9b362c199dc03619c
fuzzy: don't use readarray for xfsfind output

Some of the scrub stress tests (e.g. xfs/796) walk the directory tree to
find filepaths to scrub, and load the entire list of paths into a bash
array.  On a large filesystem or a long-running test this is hugely
wasteful of memory because we use each path exactly once.

Fix __stress_one_scrub_loop to avoid this by reading lines directly from
the output of the xfsfind utility.  However, we play some games with fd
77 so that the processes in the loop body will use the same stdin as the
test and /not/ the piped stdout of xfsfind.

To avoid read(1) becoming confused by newlines in the file paths, adapt
xfsfind to print nulls between pathnames, and the bash code to recognize
them.

This was a debugging patch while I was trying to figure out why xfs/286
and other scrub soak tests started OOMing after the v2024.12.08 changes,
though in the end the OOMs were the result of memory leaks in fsstress.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/fuzzy
src/xfsfind.c