Skip to content

Commit

Permalink
io_tester: ensure that file object is valid when closing it
Browse files Browse the repository at this point in the history
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 <[email protected]>

Closes scylladb#2307
  • Loading branch information
pwrobelse authored and ptrsmrn committed Jul 17, 2024
1 parent a197854 commit 9e3550e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/io_tester/io_tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<file, uint64_t> p) {
return p.first.close();
return do_with(std::move(p.first), [] (auto& f) {
return f.close();
});
});
});
}
Expand Down

0 comments on commit 9e3550e

Please sign in to comment.