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 lovio committed Aug 30, 2024
1 parent 8ff5532 commit 7a00cea
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 7a00cea

Please sign in to comment.