Skip to content

Commit 55c7788

Browse files
Paulo AlcantaraSteve French
authored andcommitted
smb: client: set correct d_type for reparse points under DFS mounts
Send query dir requests with an info level of SMB_FIND_FILE_FULL_DIRECTORY_INFO rather than SMB_FIND_FILE_DIRECTORY_INFO when the client is generating its own inode numbers (e.g. noserverino) so that reparse tags still can be parsed directly from the responses, but server won't send UniqueId (server inode number) Signed-off-by: Paulo Alcantara <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 45be088 commit 55c7788

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

fs/smb/client/readdir.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,16 @@ cifs_dir_info_to_fattr(struct cifs_fattr *fattr, FILE_DIRECTORY_INFO *info,
307307
}
308308

309309
static void cifs_fulldir_info_to_fattr(struct cifs_fattr *fattr,
310-
SEARCH_ID_FULL_DIR_INFO *info,
310+
const void *info,
311311
struct cifs_sb_info *cifs_sb)
312312
{
313+
const FILE_FULL_DIRECTORY_INFO *di = info;
314+
313315
__dir_info_to_fattr(fattr, info);
314316

315-
/* See MS-FSCC 2.4.19 FileIdFullDirectoryInformation */
317+
/* See MS-FSCC 2.4.14, 2.4.19 */
316318
if (fattr->cf_cifsattrs & ATTR_REPARSE)
317-
fattr->cf_cifstag = le32_to_cpu(info->EaSize);
319+
fattr->cf_cifstag = le32_to_cpu(di->EaSize);
318320
cifs_fill_common_info(fattr, cifs_sb);
319321
}
320322

@@ -396,7 +398,7 @@ _initiate_cifs_search(const unsigned int xid, struct file *file,
396398
} else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
397399
cifsFile->srch_inf.info_level = SMB_FIND_FILE_ID_FULL_DIR_INFO;
398400
} else /* not srvinos - BB fixme add check for backlevel? */ {
399-
cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO;
401+
cifsFile->srch_inf.info_level = SMB_FIND_FILE_FULL_DIRECTORY_INFO;
400402
}
401403

402404
search_flags = CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME;
@@ -987,10 +989,9 @@ static int cifs_filldir(char *find_entry, struct file *file,
987989
(FIND_FILE_STANDARD_INFO *)find_entry,
988990
cifs_sb);
989991
break;
992+
case SMB_FIND_FILE_FULL_DIRECTORY_INFO:
990993
case SMB_FIND_FILE_ID_FULL_DIR_INFO:
991-
cifs_fulldir_info_to_fattr(&fattr,
992-
(SEARCH_ID_FULL_DIR_INFO *)find_entry,
993-
cifs_sb);
994+
cifs_fulldir_info_to_fattr(&fattr, find_entry, cifs_sb);
994995
break;
995996
default:
996997
cifs_dir_info_to_fattr(&fattr,

fs/smb/client/smb2pdu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,6 +5206,9 @@ int SMB2_query_directory_init(const unsigned int xid,
52065206
case SMB_FIND_FILE_POSIX_INFO:
52075207
req->FileInformationClass = SMB_FIND_FILE_POSIX_INFO;
52085208
break;
5209+
case SMB_FIND_FILE_FULL_DIRECTORY_INFO:
5210+
req->FileInformationClass = FILE_FULL_DIRECTORY_INFORMATION;
5211+
break;
52095212
default:
52105213
cifs_tcon_dbg(VFS, "info level %u isn't supported\n",
52115214
info_level);
@@ -5275,6 +5278,9 @@ smb2_parse_query_directory(struct cifs_tcon *tcon,
52755278
/* note that posix payload are variable size */
52765279
info_buf_size = sizeof(struct smb2_posix_info);
52775280
break;
5281+
case SMB_FIND_FILE_FULL_DIRECTORY_INFO:
5282+
info_buf_size = sizeof(FILE_FULL_DIRECTORY_INFO);
5283+
break;
52785284
default:
52795285
cifs_tcon_dbg(VFS, "info level %u isn't supported\n",
52805286
srch_inf->info_level);

0 commit comments

Comments
 (0)