fs/ntfs3: Fix getting file type
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 4 Jun 2024 07:41:39 +0000 (10:41 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 7 Jun 2024 11:31:08 +0000 (14:31 +0300)
An additional condition causes the mft record to be read from disk
and get the file type dt_type.

Fixes: 22457c047ed97 ("fs/ntfs3: Modified fix directory element type detection")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/dir.c

index 1937e8e612f87abd733050e1644efa1df6bc1af1..858efe255f6f3aa2c2d04702d2dd3b281de124d2 100644 (file)
@@ -326,7 +326,8 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
         * It does additional locks/reads just to get the type of name.
         * Should we use additional mount option to enable branch below?
         */
-       if ((fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) &&
+       if (((fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) ||
+            fname->dup.ea_size) &&
            ino != ni->mi.rno) {
                struct inode *inode = ntfs_iget5(sbi->sb, &e->ref, NULL);
                if (!IS_ERR_OR_NULL(inode)) {