struct inode *inode = dentry->d_inode;
        struct path_cond cond = { };
 
-       if (!inode || !dir->mnt || !mediated_filesystem(inode))
+       if (!inode || !dir->mnt || !mediated_filesystem(dentry))
                return 0;
 
        cond.uid = inode->i_uid;
 {
        struct path_cond cond = { current_fsuid(), mode };
 
-       if (!dir->mnt || !mediated_filesystem(dir->dentry->d_inode))
+       if (!dir->mnt || !mediated_filesystem(dir->dentry))
                return 0;
 
        return common_perm_dir_dentry(op, dir, dentry, mask, &cond);
                                  path->dentry->d_inode->i_mode
        };
 
-       if (!path->mnt || !mediated_filesystem(path->dentry->d_inode))
+       if (!path->mnt || !mediated_filesystem(path->dentry))
                return 0;
 
        return common_perm(OP_TRUNC, path, MAY_WRITE | AA_MAY_META_WRITE,
        struct aa_profile *profile;
        int error = 0;
 
-       if (!mediated_filesystem(old_dentry->d_inode))
+       if (!mediated_filesystem(old_dentry))
                return 0;
 
        profile = aa_current_profile();
        struct aa_profile *profile;
        int error = 0;
 
-       if (!mediated_filesystem(old_dentry->d_inode))
+       if (!mediated_filesystem(old_dentry))
                return 0;
 
        profile = aa_current_profile();
 
 static int apparmor_path_chmod(struct path *path, umode_t mode)
 {
-       if (!mediated_filesystem(path->dentry->d_inode))
+       if (!mediated_filesystem(path->dentry))
                return 0;
 
        return common_perm_mnt_dentry(OP_CHMOD, path->mnt, path->dentry, AA_MAY_CHMOD);
                                   path->dentry->d_inode->i_mode
        };
 
-       if (!mediated_filesystem(path->dentry->d_inode))
+       if (!mediated_filesystem(path->dentry))
                return 0;
 
        return common_perm(OP_CHOWN, path, AA_MAY_CHOWN, &cond);
 
 static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
 {
-       if (!mediated_filesystem(dentry->d_inode))
+       if (!mediated_filesystem(dentry))
                return 0;
 
        return common_perm_mnt_dentry(OP_GETATTR, mnt, dentry,
        struct aa_profile *profile;
        int error = 0;
 
-       if (!mediated_filesystem(file_inode(file)))
+       if (!mediated_filesystem(file->f_path.dentry))
                return 0;
 
        /* If in exec, permission is handled by bprm hooks.
        BUG_ON(!fprofile);
 
        if (!file->f_path.mnt ||
-           !mediated_filesystem(file_inode(file)))
+           !mediated_filesystem(file->f_path.dentry))
                return 0;
 
        profile = __aa_current_profile();