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]>
  • Loading branch information
pwrobelse committed Jun 28, 2024
1 parent eaf51a3 commit e56fa53
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 e56fa53

Please sign in to comment.