mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
cifs: introduce cifs_ses_mark_for_reconnect() helper
Use new cifs_ses_mark_for_reconnect() helper to mark all session channels for reconnect instead of duplicating it in different places. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
446e21482e
commit
8ae87bbeb5
5 changed files with 18 additions and 33 deletions
|
@ -393,26 +393,14 @@ static void cifs_put_swn_reg(struct cifs_swn_reg *swnreg)
|
||||||
|
|
||||||
static int cifs_swn_resource_state_changed(struct cifs_swn_reg *swnreg, const char *name, int state)
|
static int cifs_swn_resource_state_changed(struct cifs_swn_reg *swnreg, const char *name, int state)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case CIFS_SWN_RESOURCE_STATE_UNAVAILABLE:
|
case CIFS_SWN_RESOURCE_STATE_UNAVAILABLE:
|
||||||
cifs_dbg(FYI, "%s: resource name '%s' become unavailable\n", __func__, name);
|
cifs_dbg(FYI, "%s: resource name '%s' become unavailable\n", __func__, name);
|
||||||
for (i = 0; i < swnreg->tcon->ses->chan_count; i++) {
|
cifs_ses_mark_for_reconnect(swnreg->tcon->ses);
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
if (swnreg->tcon->ses->chans[i].server->tcpStatus != CifsExiting)
|
|
||||||
swnreg->tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect;
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CIFS_SWN_RESOURCE_STATE_AVAILABLE:
|
case CIFS_SWN_RESOURCE_STATE_AVAILABLE:
|
||||||
cifs_dbg(FYI, "%s: resource name '%s' become available\n", __func__, name);
|
cifs_dbg(FYI, "%s: resource name '%s' become available\n", __func__, name);
|
||||||
for (i = 0; i < swnreg->tcon->ses->chan_count; i++) {
|
cifs_ses_mark_for_reconnect(swnreg->tcon->ses);
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
if (swnreg->tcon->ses->chans[i].server->tcpStatus != CifsExiting)
|
|
||||||
swnreg->tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect;
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CIFS_SWN_RESOURCE_STATE_UNKNOWN:
|
case CIFS_SWN_RESOURCE_STATE_UNKNOWN:
|
||||||
cifs_dbg(FYI, "%s: resource name '%s' changed to unknown state\n", __func__, name);
|
cifs_dbg(FYI, "%s: resource name '%s' changed to unknown state\n", __func__, name);
|
||||||
|
|
|
@ -599,6 +599,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
|
||||||
bool is_server_using_iface(struct TCP_Server_Info *server,
|
bool is_server_using_iface(struct TCP_Server_Info *server,
|
||||||
struct cifs_server_iface *iface);
|
struct cifs_server_iface *iface);
|
||||||
bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface);
|
bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface);
|
||||||
|
void cifs_ses_mark_for_reconnect(struct cifs_ses *ses);
|
||||||
|
|
||||||
void extract_unc_hostname(const char *unc, const char **h, size_t *len);
|
void extract_unc_hostname(const char *unc, const char **h, size_t *len);
|
||||||
int copy_path_name(char *dst, const char *src);
|
int copy_path_name(char *dst, const char *src);
|
||||||
|
|
|
@ -4113,18 +4113,6 @@ cifs_prune_tlinks(struct work_struct *work)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||||
static void mark_tcon_tcp_ses_for_reconnect(struct cifs_tcon *tcon)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < tcon->ses->chan_count; i++) {
|
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
if (tcon->ses->chans[i].server->tcpStatus != CifsExiting)
|
|
||||||
tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect;
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update dfs referral path of superblock */
|
/* Update dfs referral path of superblock */
|
||||||
static int update_server_fullpath(struct TCP_Server_Info *server, struct cifs_sb_info *cifs_sb,
|
static int update_server_fullpath(struct TCP_Server_Info *server, struct cifs_sb_info *cifs_sb,
|
||||||
const char *target)
|
const char *target)
|
||||||
|
@ -4301,7 +4289,7 @@ static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
|
||||||
*/
|
*/
|
||||||
if (rc && server->current_fullpath != server->origin_fullpath) {
|
if (rc && server->current_fullpath != server->origin_fullpath) {
|
||||||
server->current_fullpath = server->origin_fullpath;
|
server->current_fullpath = server->origin_fullpath;
|
||||||
mark_tcon_tcp_ses_for_reconnect(tcon);
|
cifs_ses_mark_for_reconnect(tcon->ses);
|
||||||
}
|
}
|
||||||
|
|
||||||
dfs_cache_free_tgts(tl);
|
dfs_cache_free_tgts(tl);
|
||||||
|
|
|
@ -1355,12 +1355,7 @@ static void mark_for_reconnect_if_needed(struct cifs_tcon *tcon, struct dfs_cach
|
||||||
}
|
}
|
||||||
|
|
||||||
cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__);
|
cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__);
|
||||||
for (i = 0; i < tcon->ses->chan_count; i++) {
|
cifs_ses_mark_for_reconnect(tcon->ses);
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
if (tcon->ses->chans[i].server->tcpStatus != CifsExiting)
|
|
||||||
tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect;
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Refresh dfs referral of tcon and mark it for reconnect if needed */
|
/* Refresh dfs referral of tcon and mark it for reconnect if needed */
|
||||||
|
|
|
@ -318,6 +318,19 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark all session channels for reconnect */
|
||||||
|
void cifs_ses_mark_for_reconnect(struct cifs_ses *ses)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ses->chan_count; i++) {
|
||||||
|
spin_lock(&GlobalMid_Lock);
|
||||||
|
if (ses->chans[i].server->tcpStatus != CifsExiting)
|
||||||
|
ses->chans[i].server->tcpStatus = CifsNeedReconnect;
|
||||||
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
|
static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
|
||||||
{
|
{
|
||||||
__u32 capabilities = 0;
|
__u32 capabilities = 0;
|
||||||
|
|
Loading…
Reference in a new issue