Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 641089c1 authored by Miklos Szeredi's avatar Miklos Szeredi
Browse files

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: default avatarMiklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
parent b93d4a0e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);