Skip to content

Commit 5825240

Browse files
Paulo Alcantaragregkh
authored andcommitted
smb: client: set correct d_type for reparse DFS/DFSR and mount point
[ Upstream commit 8bd25b6 ] Set correct dirent->d_type for IO_REPARSE_TAG_DFS{,R} and IO_REPARSE_TAG_MOUNT_POINT reparse points. Signed-off-by: Paulo Alcantara <[email protected]> Signed-off-by: Steve French <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 97db416 commit 5825240

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

fs/smb/client/reparse.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,34 +482,35 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,
482482
switch (le64_to_cpu(buf->InodeType)) {
483483
case NFS_SPECFILE_CHR:
484484
fattr->cf_mode |= S_IFCHR;
485-
fattr->cf_dtype = DT_CHR;
486485
fattr->cf_rdev = reparse_nfs_mkdev(buf);
487486
break;
488487
case NFS_SPECFILE_BLK:
489488
fattr->cf_mode |= S_IFBLK;
490-
fattr->cf_dtype = DT_BLK;
491489
fattr->cf_rdev = reparse_nfs_mkdev(buf);
492490
break;
493491
case NFS_SPECFILE_FIFO:
494492
fattr->cf_mode |= S_IFIFO;
495-
fattr->cf_dtype = DT_FIFO;
496493
break;
497494
case NFS_SPECFILE_SOCK:
498495
fattr->cf_mode |= S_IFSOCK;
499-
fattr->cf_dtype = DT_SOCK;
500496
break;
501497
case NFS_SPECFILE_LNK:
502498
fattr->cf_mode |= S_IFLNK;
503-
fattr->cf_dtype = DT_LNK;
504499
break;
505500
default:
506501
WARN_ON_ONCE(1);
507502
return false;
508503
}
509-
return true;
504+
goto out;
510505
}
511506

512507
switch (tag) {
508+
case IO_REPARSE_TAG_DFS:
509+
case IO_REPARSE_TAG_DFSR:
510+
case IO_REPARSE_TAG_MOUNT_POINT:
511+
/* See cifs_create_junction_fattr() */
512+
fattr->cf_mode = S_IFDIR | 0711;
513+
break;
513514
case IO_REPARSE_TAG_LX_SYMLINK:
514515
case IO_REPARSE_TAG_LX_FIFO:
515516
case IO_REPARSE_TAG_AF_UNIX:
@@ -521,10 +522,11 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,
521522
case IO_REPARSE_TAG_SYMLINK:
522523
case IO_REPARSE_TAG_NFS:
523524
fattr->cf_mode |= S_IFLNK;
524-
fattr->cf_dtype = DT_LNK;
525525
break;
526526
default:
527527
return false;
528528
}
529+
out:
530+
fattr->cf_dtype = S_DT(fattr->cf_mode);
529531
return true;
530532
}

0 commit comments

Comments
 (0)