fs: ubifs: Handle zero-length files issue on rename
The following use case scenario may result in a zero length file
if a power cut occurred before the cache was flushed:
1. Users-space app creates the file (open/fopen call)
2. Writes data to the file (write/fwrite calls)
3. Close the file (close/fclose call)
4. Rename the file
5. power cut
The proper way to prevent this would be to call fsync or fdatasync after
the rename operation in userspace app. In order to avoid updating
already existing user application the rename implementation was
updated to sync the old file data prior to renaming it.
Change-Id: I8b49222e06bf762efa72d8e6940d1e61d6e5364b
Signed-off-by:
Tanya Brokhman <tlinder@codeaurora.org>
Loading
Please register or sign in to comment