Skip to content

Commit ca00c70

Browse files
committed
Merge tag '6.8-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: - reconnect fix - multichannel channel selection fix - minor mount warning fix - reparse point fix - null pointer check improvement * tag '6.8-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb3: clarify mount warning cifs: handle cases where multiple sessions share connection cifs: change tcon status when need_reconnect is set on it smb: client: set correct d_type for reparse points under DFS mounts smb3: add missing null server pointer check
2 parents e1e3f53 + a5cc98e commit ca00c70

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

fs/smb/client/connect.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
233233
list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) {
234234
/* check if iface is still active */
235235
spin_lock(&ses->chan_lock);
236+
if (cifs_ses_get_chan_index(ses, server) ==
237+
CIFS_INVAL_CHAN_INDEX) {
238+
spin_unlock(&ses->chan_lock);
239+
continue;
240+
}
241+
236242
if (!cifs_chan_is_iface_active(ses, server)) {
237243
spin_unlock(&ses->chan_lock);
238244
cifs_chan_update_iface(ses, server);
@@ -4228,6 +4234,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
42284234

42294235
/* only send once per connect */
42304236
spin_lock(&tcon->tc_lock);
4237+
4238+
/* if tcon is marked for needing reconnect, update state */
4239+
if (tcon->need_reconnect)
4240+
tcon->status = TID_NEED_TCON;
4241+
42314242
if (tcon->status == TID_GOOD) {
42324243
spin_unlock(&tcon->tc_lock);
42334244
return 0;

fs/smb/client/dfs.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
565565

566566
/* only send once per connect */
567567
spin_lock(&tcon->tc_lock);
568+
569+
/* if tcon is marked for needing reconnect, update state */
570+
if (tcon->need_reconnect)
571+
tcon->status = TID_NEED_TCON;
572+
568573
if (tcon->status == TID_GOOD) {
569574
spin_unlock(&tcon->tc_lock);
570575
return 0;
@@ -625,8 +630,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
625630
spin_lock(&tcon->tc_lock);
626631
if (tcon->status == TID_IN_TCON)
627632
tcon->status = TID_GOOD;
628-
spin_unlock(&tcon->tc_lock);
629633
tcon->need_reconnect = false;
634+
spin_unlock(&tcon->tc_lock);
630635
}
631636

632637
return rc;

fs/smb/client/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
175175

176176
/* only send once per connect */
177177
spin_lock(&tcon->tc_lock);
178+
if (tcon->need_reconnect)
179+
tcon->status = TID_NEED_RECON;
180+
178181
if (tcon->status != TID_NEED_RECON) {
179182
spin_unlock(&tcon->tc_lock);
180183
return;

fs/smb/client/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c
211211

212212
switch (match_token(value, cifs_secflavor_tokens, args)) {
213213
case Opt_sec_krb5p:
214-
cifs_errorf(fc, "sec=krb5p is not supported!\n");
214+
cifs_errorf(fc, "sec=krb5p is not supported. Use sec=krb5,seal instead\n");
215215
return 1;
216216
case Opt_sec_krb5i:
217217
ctx->sign = true;

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/sess.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
7676
unsigned int i;
7777

7878
/* if the channel is waiting for termination */
79-
if (server->terminate)
79+
if (server && server->terminate)
8080
return CIFS_INVAL_CHAN_INDEX;
8181

8282
for (i = 0; i < ses->chan_count; i++) {
@@ -88,7 +88,6 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
8888
if (server)
8989
cifs_dbg(VFS, "unable to get chan index for server: 0x%llx",
9090
server->conn_id);
91-
WARN_ON(1);
9291
return CIFS_INVAL_CHAN_INDEX;
9392
}
9493

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)