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 <josef@toxicpanda.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Josef Bacik
2020-01-07 11:55:41 -05:00
committed by Eryu Guan
parent 27e2a2bd2f
commit fb72f6f547
+5 -1
View File
@@ -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);
}
}