Commit e3d312c4 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Greg Kroah-Hartman

ovl: fsync after copy-up

commit 641089c1 upstream.

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: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ab69d3a0
...@@ -139,6 +139,8 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) ...@@ -139,6 +139,8 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
len -= bytes; len -= bytes;
} }
if (!error)
error = vfs_fsync(new_file, 0);
fput(new_file); fput(new_file);
out_fput: out_fput:
fput(old_file); fput(old_file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment