diff mbox series

[2/3] ltp/fsx: drop caches if we're doing closeopen

Message ID 20200107165542.70108-3-josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Some fsx improvements | expand

Commit Message

Josef Bacik Jan. 7, 2020, 4:55 p.m. UTC
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.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 ltp/fsx.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/ltp/fsx.c b/ltp/fsx.c
index c74b13c2..e519367b 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1778,6 +1778,10 @@  docloseopen(void)
 		prterr("docloseopen: close");
 		report_failure(180);
 	}
+	if (system("echo 3 > /proc/sys/vm/drop_caches")) {
+		prterr("docloseopen: drop_caches");
+		report_failure(213);
+	}
 	fd = open(fname, O_RDWR|o_direct, 0);
 	if (fd < 0) {
 		prterr("docloseopen: open");