summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-10-31 14:42:14 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2016-10-31 14:42:14 +0100
commit641089c1549d8d3df0b047b5de7e9a111362cdce (patch)
tree67e66cc4416dd6ba0beda9304cc3b5c242a39003 /fs
parentb93d4a0eb308d4400b84c8b24c1b80e09a9497d0 (diff)
downloadlinux-641089c1549d8d3df0b047b5de7e9a111362cdce.tar.gz
linux-641089c1549d8d3df0b047b5de7e9a111362cdce.tar.bz2
linux-641089c1549d8d3df0b047b5de7e9a111362cdce.zip
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>
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 aeb60f791418..36795eed40b0 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -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);