bool is_dir;
        unsigned long ino = inode->i_ino;
        u32 rp_fa = 0, asize, t32;
-       u16 roff, rsize, names = 0;
+       u16 roff, rsize, names = 0, links = 0;
        const struct ATTR_FILE_NAME *fname = NULL;
        const struct INDEX_ROOT *root;
        struct REPARSE_DATA_BUFFER rp; // 0x18 bytes
                    rsize < SIZEOF_ATTRIBUTE_FILENAME)
                        goto out;
 
+               names += 1;
                fname = Add2Ptr(attr, roff);
                if (fname->type == FILE_NAME_DOS)
                        goto next_attr;
 
-               names += 1;
+               links += 1;
                if (name && name->len == fname->name_len &&
                    !ntfs_cmp_names_cpu(name, (struct le_str *)&fname->name_len,
                                        NULL, false))
                ni->mi.dirty = true;
        }
 
-       set_nlink(inode, names);
+       set_nlink(inode, links);
 
        if (S_ISDIR(mode)) {
                ni->std_fa |= FILE_ATTRIBUTE_DIRECTORY;
 
        if (aoff + asize > used)
                return false;
 
-       if (ni && is_attr_indexed(attr)) {
+       if (ni && is_attr_indexed(attr) && attr->type == ATTR_NAME) {
                u16 links = le16_to_cpu(ni->mi.mrec->hard_links);
-               struct ATTR_FILE_NAME *fname =
-                       attr->type != ATTR_NAME ?
-                               NULL :
-                               resident_data_ex(attr,
-                                                SIZEOF_ATTRIBUTE_FILENAME);
-               if (fname && fname->type == FILE_NAME_DOS) {
-                       /* Do not decrease links count deleting DOS name. */
-               } else if (!links) {
+               if (!links) {
                        /* minor error. Not critical. */
                } else {
                        ni->mi.mrec->hard_links = cpu_to_le16(links - 1);