From 7a00cea51217d059057b2c308660ed719c3051c5 Mon Sep 17 00:00:00 2001 From: Patryk Wrobel Date: Fri, 28 Jun 2024 10:27:39 +0200 Subject: [PATCH] io_tester: ensure that file object is valid when closing it In the case of unlink workloads they create and fill files and close them right away. This change ensures that the file object is valid until close() finishes. Signed-off-by: Patryk Wrobel Closes scylladb/seastar#2307 --- apps/io_tester/io_tester.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/io_tester/io_tester.cc b/apps/io_tester/io_tester.cc index 7a7bf398563..26e1e59f2ab 100644 --- a/apps/io_tester/io_tester.cc +++ b/apps/io_tester/io_tester.cc @@ -784,7 +784,9 @@ class unlink_class_data : public class_data { options.append_is_unlikely = true; return create_and_fill_file(fname, fsize, flags, options).then([](std::pair p) { - return p.first.close(); + return do_with(std::move(p.first), [] (auto& f) { + return f.close(); + }); }); }); }