summaryrefslogtreecommitdiff
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-10-31 16:42:14 +0300
committerSasha Levin <alexander.levin@verizon.com>2016-11-24 07:09:18 +0300
commitdff2cd539e4b537bf2e929eea256b20cd5262b35 (patch)
tree6ef2a7971f33b6bd66351b03d7afb2104136d68d /fs/overlayfs
parentcc30a01ae404cbf0ef1f419cbfab2af77f3c411c (diff)
downloadlinux-dff2cd539e4b537bf2e929eea256b20cd5262b35.tar.xz
ovl: fsync after copy-up
[ Upstream commit 641089c1549d8d3df0b047b5de7e9a111362cdce ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/copy_up.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 4cb1c10c7706..ca48dff09e19 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -129,6 +129,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);