secdiscard: should call fsync to avoid reordering IOs am: 6c5e453f9e am: 732faaeb94

am: ceac8b8587

Change-Id: I0681b3aba14a0723f904c5e9246811e035949130
gugelfrei
Jaegeuk Kim 5 years ago committed by android-build-merger
commit 6a1fc39c5a

@ -147,6 +147,10 @@ bool secdiscard_path(const std::string& path) {
if (!overwrite_with_zeros(fs_fd.get(), range[0], range[1])) return false;
}
}
// Should wait for overwrites completion. Otherwise after unlink(),
// filesystem can allocate these blocks and IO can be reordered, resulting
// in making zero blocks to filesystem blocks.
fsync(fs_fd.get());
return true;
}

Loading…
Cancel
Save