Skip to content

Commit 9391dd0

Browse files
author
Al Viro
committed
fix a braino in ovl_d_select_inode()
when opening a directory we want the overlayfs inode, not one from the topmost layer. Reported-By: Andrey Jr. Melnikov <temnota.am@gmail.com> Tested-By: Andrey Jr. Melnikov <temnota.am@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 0a73d0a commit 9391dd0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/overlayfs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
343343
struct path realpath;
344344
enum ovl_path_type type;
345345

346+
if (d_is_dir(dentry))
347+
return d_backing_inode(dentry);
348+
346349
type = ovl_path_real(dentry, &realpath);
347350
if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) {
348351
err = ovl_want_write(dentry);

0 commit comments

Comments
 (0)