net: phy: icplus: use PHY_ID_MATCH_MODEL() macro
[linux-2.6-microblaze.git] / fs / cifs / cifs_swn.c
index c594e58..d35f599 100644 (file)
@@ -285,8 +285,6 @@ static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
                        continue;
                }
 
-               mutex_unlock(&cifs_swnreg_idr_mutex);
-
                cifs_dbg(FYI, "Existing swn registration for %s:%s found\n", swnreg->net_name,
                                swnreg->share_name);
 
@@ -482,48 +480,51 @@ static int cifs_swn_store_swn_addr(const struct sockaddr_storage *new,
 
 static int cifs_swn_reconnect(struct cifs_tcon *tcon, struct sockaddr_storage *addr)
 {
+       int ret = 0;
+
        /* Store the reconnect address */
        mutex_lock(&tcon->ses->server->srv_mutex);
-       if (!cifs_sockaddr_equal(&tcon->ses->server->dstaddr, addr)) {
-               int ret;
-
-               ret = cifs_swn_store_swn_addr(addr, &tcon->ses->server->dstaddr,
-                               &tcon->ses->server->swn_dstaddr);
-               if (ret < 0) {
-                       cifs_dbg(VFS, "%s: failed to store address: %d\n", __func__, ret);
-                       return ret;
-               }
-               tcon->ses->server->use_swn_dstaddr = true;
+       if (cifs_sockaddr_equal(&tcon->ses->server->dstaddr, addr))
+               goto unlock;
 
-               /*
-                * Unregister to stop receiving notifications for the old IP address.
-                */
-               ret = cifs_swn_unregister(tcon);
-               if (ret < 0) {
-                       cifs_dbg(VFS, "%s: Failed to unregister for witness notifications: %d\n",
-                                       __func__, ret);
-                       return ret;
-               }
+       ret = cifs_swn_store_swn_addr(addr, &tcon->ses->server->dstaddr,
+                                     &tcon->ses->server->swn_dstaddr);
+       if (ret < 0) {
+               cifs_dbg(VFS, "%s: failed to store address: %d\n", __func__, ret);
+               goto unlock;
+       }
+       tcon->ses->server->use_swn_dstaddr = true;
 
-               /*
-                * And register to receive notifications for the new IP address now that we have
-                * stored the new address.
-                */
-               ret = cifs_swn_register(tcon);
-               if (ret < 0) {
-                       cifs_dbg(VFS, "%s: Failed to register for witness notifications: %d\n",
-                                       __func__, ret);
-                       return ret;
-               }
+       /*
+        * Unregister to stop receiving notifications for the old IP address.
+        */
+       ret = cifs_swn_unregister(tcon);
+       if (ret < 0) {
+               cifs_dbg(VFS, "%s: Failed to unregister for witness notifications: %d\n",
+                        __func__, ret);
+               goto unlock;
+       }
 
-               spin_lock(&GlobalMid_Lock);
-               if (tcon->ses->server->tcpStatus != CifsExiting)
-                       tcon->ses->server->tcpStatus = CifsNeedReconnect;
-               spin_unlock(&GlobalMid_Lock);
+       /*
+        * And register to receive notifications for the new IP address now that we have
+        * stored the new address.
+        */
+       ret = cifs_swn_register(tcon);
+       if (ret < 0) {
+               cifs_dbg(VFS, "%s: Failed to register for witness notifications: %d\n",
+                        __func__, ret);
+               goto unlock;
        }
+
+       spin_lock(&GlobalMid_Lock);
+       if (tcon->ses->server->tcpStatus != CifsExiting)
+               tcon->ses->server->tcpStatus = CifsNeedReconnect;
+       spin_unlock(&GlobalMid_Lock);
+
+unlock:
        mutex_unlock(&tcon->ses->server->srv_mutex);
 
-       return 0;
+       return ret;
 }
 
 static int cifs_swn_client_move(struct cifs_swn_reg *swnreg, struct sockaddr_storage *addr)