summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-10-31 14:42:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-10 16:36:34 +0100
commite3d312c435dd98a8b7a8dbaca9568f20449d5e47 (patch)
treed103d7f6c8129be50f7df7071c824aa2d4d86c3a /fs
parentab69d3a03e2253b3029447887a8883606e7be844 (diff)
ovl: fsync after copy-up
commit 641089c1549d8d3df0b047b5de7e9a111362cdce 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: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 ea0dd9ee138d..63a0d0ba36de 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -139,6 +139,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);