ovl: Copy up underlying inode's ->i_mode to overlay inode
[firefly-linux-kernel-4.4.55.git] / fs / overlayfs / inode.c
index 05ac9a95e88198f8ea4250ff77d32eba926efa57..0597820f5d9d72f19fbaa185cbde5249bf0fb2a9 100644 (file)
@@ -412,12 +412,11 @@ struct inode *ovl_new_inode(struct super_block *sb, umode_t mode,
        if (!inode)
                return NULL;
 
-       mode &= S_IFMT;
-
        inode->i_ino = get_next_ino();
        inode->i_mode = mode;
        inode->i_flags |= S_NOATIME | S_NOCMTIME;
 
+       mode &= S_IFMT;
        switch (mode) {
        case S_IFDIR:
                inode->i_private = oe;