diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index ed12bb19d7..d5d37345d1 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -102,9 +102,13 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) struct dentry *new_dentry; struct qstr ci_name; - ci_name.name = pn.pn_buf; - ci_name.len = strlen(pn.pn_buf); - new_dentry = d_add_ci(dentry, ip, &ci_name); + if (strcmp(dname(dentry), pn.pn_buf) == 0) { + new_dentry = d_splice_alias(ip, dentry); + } else { + ci_name.name = pn.pn_buf; + ci_name.len = strlen(pn.pn_buf); + new_dentry = d_add_ci(dentry, ip, &ci_name); + } kmem_free(pn.pn_buf, ZFS_MAXNAMELEN); return (new_dentry); } else {