]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ovl: do not open non-data lower file for fsync
authorAmir Goldstein <amir73il@gmail.com>
Tue, 5 Nov 2024 20:28:06 +0000 (21:28 +0100)
committerAmir Goldstein <amir73il@gmail.com>
Fri, 15 Nov 2024 07:56:48 +0000 (08:56 +0100)
commitc2c54b5f34f6341f24d06689d4b986bd75b4b41c
tree797d2a08b3d9764ee351d6d6e59d6d3378df7375
parentc5b28fc161c5402da2e10cc11637c2dff727ac23
ovl: do not open non-data lower file for fsync

ovl_fsync() with !datasync opens a backing file from the top most dentry
in the stack, checks if this dentry is non-upper and skips the fsync.

In case of an overlay dentry stack with lower data and lower metadata
above it, but without an upper metadata above it, the backing file is
opened from the top most lower metadata dentry and never used.

Refactor the helper ovl_real_fdget_meta() into ovl_real_fdget_path() and
open code the checks for non-upper inode in ovl_fsync(), so in that case
we can avoid the unneeded backing file open.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
fs/overlayfs/file.c