]> git.ipfire.org Git - thirdparty/linux.git/commit
readdir: require opt-in for d_type flags
authorAmir Goldstein <amir73il@gmail.com>
Thu, 8 Jan 2026 07:45:22 +0000 (08:45 +0100)
committerChristian Brauner <brauner@kernel.org>
Mon, 12 Jan 2026 09:57:34 +0000 (10:57 +0100)
commitc644bce62b9c6b441143a03c910f986109c47001
tree6a604afe0fdade458369e60c3c6533b86ffd02a3
parent7d42f2b1cc3a60a71784967384ddcf29fe3f35ed
readdir: require opt-in for d_type flags

Commit c31f91c6af96 ("fuse: don't allow signals to interrupt getdents
copying") introduced the use of high bits in d_type as flags. However,
overlayfs was not adapted to handle this change.

In ovl_cache_entry_new(), the code checks if d_type == DT_CHR to
determine if an entry might be a whiteout. When fuse is used as the
lower layer and sets high bits in d_type, this comparison fails,
causing whiteout files to not be recognized properly and resulting in
incorrect overlayfs behavior.

Fix this by requiring callers of iterate_dir() to opt-in for getting
flag bits in d_type outside of S_DT_MASK.

Fixes: c31f91c6af96 ("fuse: don't allow signals to interrupt getdents copying")
Link: https://lore.kernel.org/all/20260107034551.439-1-luochunsheng@ustc.edu/
Link: https://github.com/containerd/stargz-snapshotter/issues/2214
Reported-by: Chunsheng Luo <luochunsheng@ustc.edu>
Reviewed-by: Chunsheng Luo <luochunsheng@ustc.edu>
Tested-by: Chunsheng Luo <luochunsheng@ustc.edu>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20260108074522.3400998-1-amir73il@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/readdir.c
include/linux/fs.h