cifs: minor simplification to smb2_is_network_name_deleted
authorSteve French <stfrench@microsoft.com>
Sun, 21 Feb 2021 00:52:15 +0000 (18:52 -0600)
committerSteve French <stfrench@microsoft.com>
Tue, 23 Feb 2021 10:16:41 +0000 (04:16 -0600)
Trivial change to clarify code in smb2_is_network_name_deleted

Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index 807ecd444c16449ea6ce64fd618f9b587df23ae6..f5087295424c65dfa1c9444f02890f8fcec8fc41 100644 (file)
@@ -2459,23 +2459,24 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
        struct cifs_ses *ses;
        struct cifs_tcon *tcon;
 
-       if (shdr->Status == STATUS_NETWORK_NAME_DELETED) {
-               spin_lock(&cifs_tcp_ses_lock);
-               list_for_each(tmp, &server->smb_ses_list) {
-                       ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
-                       list_for_each(tmp1, &ses->tcon_list) {
-                               tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
-                               if (tcon->tid == shdr->TreeId) {
-                                       tcon->need_reconnect = true;
-                                       spin_unlock(&cifs_tcp_ses_lock);
-                                       pr_warn_once("Server share %s deleted.\n",
-                                                    tcon->treeName);
-                                       return;
-                               }
+       if (shdr->Status != STATUS_NETWORK_NAME_DELETED)
+               return;
+
+       spin_lock(&cifs_tcp_ses_lock);
+       list_for_each(tmp, &server->smb_ses_list) {
+               ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
+               list_for_each(tmp1, &ses->tcon_list) {
+                       tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
+                       if (tcon->tid == shdr->TreeId) {
+                               tcon->need_reconnect = true;
+                               spin_unlock(&cifs_tcp_ses_lock);
+                               pr_warn_once("Server share %s deleted.\n",
+                                            tcon->treeName);
+                               return;
                        }
                }
-               spin_unlock(&cifs_tcp_ses_lock);
        }
+       spin_unlock(&cifs_tcp_ses_lock);
 }
 
 static int