mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
ovl: fsync after copy-up
Make sure the copied up file hits the disk before renaming to the final destination. If this is not done then the copy-up may corrupt the data in the file in case of a crash. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Cc: <stable@vger.kernel.org>
This commit is contained in:
parent
b93d4a0eb3
commit
641089c154
1 changed files with 2 additions and 0 deletions
|
@ -178,6 +178,8 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
|
|||
len -= bytes;
|
||||
}
|
||||
|
||||
if (!error)
|
||||
error = vfs_fsync(new_file, 0);
|
||||
fput(new_file);
|
||||
out_fput:
|
||||
fput(old_file);
|
||||
|
|
Loading…
Reference in a new issue