mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
four cifs/smb3 client fixes, including two for stable
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmQoaaoACgkQiiy9cAdy T1FBYwv/VTfy25fwnT06Zcu+gPrfXTNJmTvbf1SP6xoFrr9wTjNRh3fc8/3mbqey UaxAFoPOR8Pot0R9bApW2ieOKXJt3ywFxkcMUkzTMAc+LPrmzXRxpOm8MW7s5aX+ 4K1xgtnXH220WqMIDrVK4lc7oqBPSOADtiq8IO/Dy8YurRLxg1GDoAAS7QZqJ7eB ODVMRcjVMtQnowtcXtS6KdKROea+ZmwPvctQZGL3H2n/W4ktp+TZ2CPfSPAas5FR oQFEIKe31YSPD/88rkUvdxW+s/Gu5DuaGc4JzOAOtnkCxEi0ypI7GTDC/XmKulzN cTfrnLDPVKFVdbpgiQiEGBqLCenczqMdgnDJh0S8KIEjl/+XTyY6DlvF+FUjRJL0 CFagDTeqO8BaQJjV8mvxLX+eH2ex4LHHOObEqKl/zPivaMTx7S0whhhrYjw6r+0T HmXdZr49CDIoE+v5RTsnK5Ol1mWVKQvfZJ5Uc6G/HzeV+9XUtkJI/FWH88idHO1L VUNqMv64 =uCV8 -----END PGP SIGNATURE----- Merge tag '6.3-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 Pull cifs client fixes from Steve French: "Four cifs/smb3 client (reconnect and DFS related) fixes, including two for stable: - DFS oops fix - DFS reconnect recursion fix - An SMB1 parallel reconnect fix - Trivial dead code removal in smb2_reconnect" * tag '6.3-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: get rid of dead check in smb2_reconnect() cifs: prevent infinite recursion in CIFSGetDFSRefer() cifs: avoid races in parallel reconnects in smb1 cifs: fix DFS traversal oops without CONFIG_CIFS_DFS_UPCALL
This commit is contained in:
commit
f7772da662
@ -124,7 +124,10 @@ extern const struct dentry_operations cifs_ci_dentry_ops;
|
||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||
extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
|
||||
#else
|
||||
#define cifs_dfs_d_automount NULL
|
||||
static inline struct vfsmount *cifs_dfs_d_automount(struct path *path)
|
||||
{
|
||||
return ERR_PTR(-EREMOTE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Functions related to symlinks */
|
||||
|
@ -71,7 +71,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
|
||||
int rc;
|
||||
struct cifs_ses *ses;
|
||||
struct TCP_Server_Info *server;
|
||||
struct nls_table *nls_codepage;
|
||||
struct nls_table *nls_codepage = NULL;
|
||||
|
||||
/*
|
||||
* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for
|
||||
@ -99,6 +99,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
|
||||
}
|
||||
spin_unlock(&tcon->tc_lock);
|
||||
|
||||
again:
|
||||
rc = cifs_wait_for_server_reconnect(server, tcon->retry);
|
||||
if (rc)
|
||||
return rc;
|
||||
@ -110,8 +111,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
|
||||
}
|
||||
spin_unlock(&ses->chan_lock);
|
||||
|
||||
nls_codepage = load_nls_default();
|
||||
|
||||
mutex_lock(&ses->session_mutex);
|
||||
/*
|
||||
* Recheck after acquire mutex. If another thread is negotiating
|
||||
* and the server never sends an answer the socket will be closed
|
||||
@ -120,29 +120,38 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
|
||||
spin_lock(&server->srv_lock);
|
||||
if (server->tcpStatus == CifsNeedReconnect) {
|
||||
spin_unlock(&server->srv_lock);
|
||||
mutex_lock(&ses->session_mutex);
|
||||
|
||||
if (tcon->retry)
|
||||
goto again;
|
||||
rc = -EHOSTDOWN;
|
||||
goto out;
|
||||
}
|
||||
spin_unlock(&server->srv_lock);
|
||||
|
||||
nls_codepage = load_nls_default();
|
||||
|
||||
/*
|
||||
* need to prevent multiple threads trying to simultaneously
|
||||
* reconnect the same SMB session
|
||||
*/
|
||||
spin_lock(&ses->ses_lock);
|
||||
spin_lock(&ses->chan_lock);
|
||||
if (!cifs_chan_needs_reconnect(ses, server)) {
|
||||
if (!cifs_chan_needs_reconnect(ses, server) &&
|
||||
ses->ses_status == SES_GOOD) {
|
||||
spin_unlock(&ses->chan_lock);
|
||||
spin_unlock(&ses->ses_lock);
|
||||
|
||||
/* this means that we only need to tree connect */
|
||||
if (tcon->need_reconnect)
|
||||
goto skip_sess_setup;
|
||||
|
||||
rc = -EHOSTDOWN;
|
||||
mutex_unlock(&ses->session_mutex);
|
||||
goto out;
|
||||
}
|
||||
spin_unlock(&ses->chan_lock);
|
||||
spin_unlock(&ses->ses_lock);
|
||||
|
||||
mutex_lock(&ses->session_mutex);
|
||||
rc = cifs_negotiate_protocol(0, ses, server);
|
||||
if (!rc)
|
||||
rc = cifs_setup_session(0, ses, server, nls_codepage);
|
||||
@ -4373,8 +4382,13 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
|
||||
return -ENODEV;
|
||||
|
||||
getDFSRetry:
|
||||
rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc, (void **) &pSMB,
|
||||
(void **) &pSMBr);
|
||||
/*
|
||||
* Use smb_init_no_reconnect() instead of smb_init() as
|
||||
* CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus
|
||||
* causing an infinite recursion.
|
||||
*/
|
||||
rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
|
||||
(void **)&pSMB, (void **)&pSMBr);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
@ -310,7 +310,6 @@ out:
|
||||
case SMB2_READ:
|
||||
case SMB2_WRITE:
|
||||
case SMB2_LOCK:
|
||||
case SMB2_IOCTL:
|
||||
case SMB2_QUERY_DIRECTORY:
|
||||
case SMB2_CHANGE_NOTIFY:
|
||||
case SMB2_QUERY_INFO:
|
||||
|
Loading…
Reference in New Issue
Block a user