Commit c071b34f authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

cifs: is_network_name_deleted should return a bool

Currently, is_network_name_deleted and it's implementations
do not return anything if the network name did get deleted.
So the function doesn't fully achieve what it advertizes.

Changed the function to return a bool instead. It will now
return true if the error returned is STATUS_NETWORK_NAME_DELETED
and the share (tree id) was found to be connected. It returns
false otherwise.
Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Acked-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent bf99f6be
...@@ -532,7 +532,7 @@ struct smb_version_operations { ...@@ -532,7 +532,7 @@ struct smb_version_operations {
/* Check for STATUS_IO_TIMEOUT */ /* Check for STATUS_IO_TIMEOUT */
bool (*is_status_io_timeout)(char *buf); bool (*is_status_io_timeout)(char *buf);
/* Check for STATUS_NETWORK_NAME_DELETED */ /* Check for STATUS_NETWORK_NAME_DELETED */
void (*is_network_name_deleted)(char *buf, struct TCP_Server_Info *srv); bool (*is_network_name_deleted)(char *buf, struct TCP_Server_Info *srv);
}; };
struct smb_version_values { struct smb_version_values {
......
...@@ -1226,9 +1226,14 @@ cifs_demultiplex_thread(void *p) ...@@ -1226,9 +1226,14 @@ cifs_demultiplex_thread(void *p)
if (mids[i] != NULL) { if (mids[i] != NULL) {
mids[i]->resp_buf_size = server->pdu_size; mids[i]->resp_buf_size = server->pdu_size;
if (bufs[i] && server->ops->is_network_name_deleted) if (bufs[i] != NULL) {
server->ops->is_network_name_deleted(bufs[i], if (server->ops->is_network_name_deleted &&
server); server->ops->is_network_name_deleted(bufs[i],
server)) {
cifs_server_dbg(FYI,
"Share deleted. Reconnect needed");
}
}
if (!mids[i]->multiRsp || mids[i]->multiEnd) if (!mids[i]->multiRsp || mids[i]->multiEnd)
mids[i]->callback(mids[i]); mids[i]->callback(mids[i]);
......
...@@ -2395,7 +2395,7 @@ smb2_is_status_io_timeout(char *buf) ...@@ -2395,7 +2395,7 @@ smb2_is_status_io_timeout(char *buf)
return false; return false;
} }
static void static bool
smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server) smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
{ {
struct smb2_hdr *shdr = (struct smb2_hdr *)buf; struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
...@@ -2404,7 +2404,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server) ...@@ -2404,7 +2404,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
struct cifs_tcon *tcon; struct cifs_tcon *tcon;
if (shdr->Status != STATUS_NETWORK_NAME_DELETED) if (shdr->Status != STATUS_NETWORK_NAME_DELETED)
return; return false;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server;
...@@ -2419,11 +2419,13 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server) ...@@ -2419,11 +2419,13 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
pr_warn_once("Server share %s deleted.\n", pr_warn_once("Server share %s deleted.\n",
tcon->tree_name); tcon->tree_name);
return; return true;
} }
} }
} }
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
return false;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment