ovl: fix failure to fsync lower dir 73/307873/1
authorAmir Goldstein <amir73il@gmail.com>
Wed, 8 Nov 2017 07:39:46 +0000 (09:39 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Mar 2024 02:20:54 +0000 (11:20 +0900)
commitd5cde6e2a558db694409b17a3de57fbc1d1d336e
tree3caa7a6bb69d1d2a8a76c0e3f3130d7bd75431b9
parentc5c927c0a83160e513031c5d0504d2f856e34ca9
ovl: fix failure to fsync lower dir

commit d796e77f1dd541fe34481af2eee6454688d13982 upstream.

As a writable mount, it is not expected for overlayfs to return
EINVAL/EROFS for fsync, even if dir/file is not changed.

This commit fixes the case of fsync of directory, which is easier to
address, because overlayfs already implements fsync file operation for
directories.

The problem reported by Raphael is that new PostgreSQL 10.0 with a
database in overlayfs where lower layer in squashfs fails to start.
The failure is due to fsync error, when PostgreSQL does fsync on all
existing db directories on startup and a specific directory exists
lower layer with no changes.

Reported-by: Raphael Hertzog <raphael@ouaza.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Tested-by: Raphaƫl Hertzog <hertzog@debian.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick linux-4.4.y commit 3b0104f9e21a to fix smack deny issue on overlayfs]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ieda49c00978f4f26f062a72e83d986d5f97d7f1f
fs/overlayfs/readdir.c