From: Josef Bacik Date: Tue, 7 Jan 2020 16:55:41 +0000 (-0500) Subject: ltp/fsx: drop caches if we're doing closeopen X-Git-Tag: v2022.05.01~892 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=fb72f6f547d7f2ecb97f33858193e58119bb5a4d ltp/fsx: drop caches if we're doing closeopen fsx has a closeopen option where it will close and then re-open the file. This is handy, but what is really more useful is to drop the file from cache completely, so add a drop_caches into this operation so that the file is read back completely from disk to be really evil. [Eryu: fix drop cache failure number to stay within 190] Signed-off-by: Josef Bacik Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/ltp/fsx.c b/ltp/fsx.c index c74b13c2..120f4374 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1778,10 +1778,14 @@ docloseopen(void) prterr("docloseopen: close"); report_failure(180); } + if (system("echo 3 > /proc/sys/vm/drop_caches")) { + prterr("docloseopen: drop_caches"); + report_failure(181); + } fd = open(fname, O_RDWR|o_direct, 0); if (fd < 0) { prterr("docloseopen: open"); - report_failure(181); + report_failure(182); } }