aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 019f00380d1..7e73176acb5 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -150,7 +150,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
150 150
151 /* before reconnecting the tcp session, mark the smb session (uid) 151 /* before reconnecting the tcp session, mark the smb session (uid)
152 and the tid bad so they are not used until reconnected */ 152 and the tid bad so they are not used until reconnected */
153 read_lock(&cifs_tcp_ses_lock); 153 spin_lock(&cifs_tcp_ses_lock);
154 list_for_each(tmp, &server->smb_ses_list) { 154 list_for_each(tmp, &server->smb_ses_list) {
155 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); 155 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list);
156 ses->need_reconnect = true; 156 ses->need_reconnect = true;
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
160 tcon->need_reconnect = true; 160 tcon->need_reconnect = true;
161 } 161 }
162 } 162 }
163 read_unlock(&cifs_tcp_ses_lock); 163 spin_unlock(&cifs_tcp_ses_lock);
164 /* do not want to be sending data on a socket we are freeing */ 164 /* do not want to be sending data on a socket we are freeing */
165 mutex_lock(&server->srv_mutex); 165 mutex_lock(&server->srv_mutex);
166 if (server->ssocket) { 166 if (server->ssocket) {
@@ -637,9 +637,9 @@ multi_t2_fnd:
637 } /* end while !EXITING */ 637 } /* end while !EXITING */
638 638
639 /* take it off the list, if it's not already */ 639 /* take it off the list, if it's not already */
640 write_lock(&cifs_tcp_ses_lock); 640 spin_lock(&cifs_tcp_ses_lock);
641 list_del_init(&server->tcp_ses_list); 641 list_del_init(&server->tcp_ses_list);
642 write_unlock(&cifs_tcp_ses_lock); 642 spin_unlock(&cifs_tcp_ses_lock);
643 643
644 spin_lock(&GlobalMid_Lock); 644 spin_lock(&GlobalMid_Lock);
645 server->tcpStatus = CifsExiting; 645 server->tcpStatus = CifsExiting;
@@ -677,7 +677,7 @@ multi_t2_fnd:
677 * BB: we shouldn't have to do any of this. It shouldn't be 677 * BB: we shouldn't have to do any of this. It shouldn't be
678 * possible to exit from the thread with active SMB sessions 678 * possible to exit from the thread with active SMB sessions
679 */ 679 */
680 read_lock(&cifs_tcp_ses_lock); 680 spin_lock(&cifs_tcp_ses_lock);
681 if (list_empty(&server->pending_mid_q)) { 681 if (list_empty(&server->pending_mid_q)) {
682 /* loop through server session structures attached to this and 682 /* loop through server session structures attached to this and
683 mark them dead */ 683 mark them dead */
@@ -687,7 +687,7 @@ multi_t2_fnd:
687 ses->status = CifsExiting; 687 ses->status = CifsExiting;
688 ses->server = NULL; 688 ses->server = NULL;
689 } 689 }
690 read_unlock(&cifs_tcp_ses_lock); 690 spin_unlock(&cifs_tcp_ses_lock);
691 } else { 691 } else {
692 /* although we can not zero the server struct pointer yet, 692 /* although we can not zero the server struct pointer yet,
693 since there are active requests which may depnd on them, 693 since there are active requests which may depnd on them,
@@ -710,7 +710,7 @@ multi_t2_fnd:
710 } 710 }
711 } 711 }
712 spin_unlock(&GlobalMid_Lock); 712 spin_unlock(&GlobalMid_Lock);
713 read_unlock(&cifs_tcp_ses_lock); 713 spin_unlock(&cifs_tcp_ses_lock);
714 /* 1/8th of sec is more than enough time for them to exit */ 714 /* 1/8th of sec is more than enough time for them to exit */
715 msleep(125); 715 msleep(125);
716 } 716 }
@@ -733,12 +733,12 @@ multi_t2_fnd:
733 if a crazy root user tried to kill cifsd 733 if a crazy root user tried to kill cifsd
734 kernel thread explicitly this might happen) */ 734 kernel thread explicitly this might happen) */
735 /* BB: This shouldn't be necessary, see above */ 735 /* BB: This shouldn't be necessary, see above */
736 read_lock(&cifs_tcp_ses_lock); 736 spin_lock(&cifs_tcp_ses_lock);
737 list_for_each(tmp, &server->smb_ses_list) { 737 list_for_each(tmp, &server->smb_ses_list) {
738 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); 738 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list);
739 ses->server = NULL; 739 ses->server = NULL;
740 } 740 }
741 read_unlock(&cifs_tcp_ses_lock); 741 spin_unlock(&cifs_tcp_ses_lock);
742 742
743 kfree(server->hostname); 743 kfree(server->hostname);
744 task_to_wake = xchg(&server->tsk, NULL); 744 task_to_wake = xchg(&server->tsk, NULL);
@@ -1524,7 +1524,7 @@ cifs_find_tcp_session(struct sockaddr *addr, struct smb_vol *vol)
1524{ 1524{
1525 struct TCP_Server_Info *server; 1525 struct TCP_Server_Info *server;
1526 1526
1527 write_lock(&cifs_tcp_ses_lock); 1527 spin_lock(&cifs_tcp_ses_lock);
1528 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { 1528 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
1529 if (!match_address(server, addr, 1529 if (!match_address(server, addr,
1530 (struct sockaddr *)&vol->srcaddr)) 1530 (struct sockaddr *)&vol->srcaddr))
@@ -1534,11 +1534,11 @@ cifs_find_tcp_session(struct sockaddr *addr, struct smb_vol *vol)
1534 continue; 1534 continue;
1535 1535
1536 ++server->srv_count; 1536 ++server->srv_count;
1537 write_unlock(&cifs_tcp_ses_lock); 1537 spin_unlock(&cifs_tcp_ses_lock);
1538 cFYI(1, "Existing tcp session with server found"); 1538 cFYI(1, "Existing tcp session with server found");
1539 return server; 1539 return server;
1540 } 1540 }
1541 write_unlock(&cifs_tcp_ses_lock); 1541 spin_unlock(&cifs_tcp_ses_lock);
1542 return NULL; 1542 return NULL;
1543} 1543}
1544 1544
@@ -1547,14 +1547,14 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)
1547{ 1547{
1548 struct task_struct *task; 1548 struct task_struct *task;
1549 1549
1550 write_lock(&cifs_tcp_ses_lock); 1550 spin_lock(&cifs_tcp_ses_lock);
1551 if (--server->srv_count > 0) { 1551 if (--server->srv_count > 0) {
1552 write_unlock(&cifs_tcp_ses_lock); 1552 spin_unlock(&cifs_tcp_ses_lock);
1553 return; 1553 return;
1554 } 1554 }
1555 1555
1556 list_del_init(&server->tcp_ses_list); 1556 list_del_init(&server->tcp_ses_list);
1557 write_unlock(&cifs_tcp_ses_lock); 1557 spin_unlock(&cifs_tcp_ses_lock);
1558 1558
1559 spin_lock(&GlobalMid_Lock); 1559 spin_lock(&GlobalMid_Lock);
1560 server->tcpStatus = CifsExiting; 1560 server->tcpStatus = CifsExiting;
@@ -1679,9 +1679,9 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1679 } 1679 }
1680 1680
1681 /* thread spawned, put it on the list */ 1681 /* thread spawned, put it on the list */
1682 write_lock(&cifs_tcp_ses_lock); 1682 spin_lock(&cifs_tcp_ses_lock);
1683 list_add(&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list); 1683 list_add(&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);
1684 write_unlock(&cifs_tcp_ses_lock); 1684 spin_unlock(&cifs_tcp_ses_lock);
1685 1685
1686 cifs_fscache_get_client_cookie(tcp_ses); 1686 cifs_fscache_get_client_cookie(tcp_ses);
1687 1687
@@ -1703,7 +1703,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
1703{ 1703{
1704 struct cifsSesInfo *ses; 1704 struct cifsSesInfo *ses;
1705 1705
1706 write_lock(&cifs_tcp_ses_lock); 1706 spin_lock(&cifs_tcp_ses_lock);
1707 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 1707 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
1708 switch (server->secType) { 1708 switch (server->secType) {
1709 case Kerberos: 1709 case Kerberos:
@@ -1723,10 +1723,10 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
1723 continue; 1723 continue;
1724 } 1724 }
1725 ++ses->ses_count; 1725 ++ses->ses_count;
1726 write_unlock(&cifs_tcp_ses_lock); 1726 spin_unlock(&cifs_tcp_ses_lock);
1727 return ses; 1727 return ses;
1728 } 1728 }
1729 write_unlock(&cifs_tcp_ses_lock); 1729 spin_unlock(&cifs_tcp_ses_lock);
1730 return NULL; 1730 return NULL;
1731} 1731}
1732 1732
@@ -1737,14 +1737,14 @@ cifs_put_smb_ses(struct cifsSesInfo *ses)
1737 struct TCP_Server_Info *server = ses->server; 1737 struct TCP_Server_Info *server = ses->server;
1738 1738
1739 cFYI(1, "%s: ses_count=%d\n", __func__, ses->ses_count); 1739 cFYI(1, "%s: ses_count=%d\n", __func__, ses->ses_count);
1740 write_lock(&cifs_tcp_ses_lock); 1740 spin_lock(&cifs_tcp_ses_lock);
1741 if (--ses->ses_count > 0) { 1741 if (--ses->ses_count > 0) {
1742 write_unlock(&cifs_tcp_ses_lock); 1742 spin_unlock(&cifs_tcp_ses_lock);
1743 return; 1743 return;
1744 } 1744 }
1745 1745
1746 list_del_init(&ses->smb_ses_list); 1746 list_del_init(&ses->smb_ses_list);
1747 write_unlock(&cifs_tcp_ses_lock); 1747 spin_unlock(&cifs_tcp_ses_lock);
1748 1748
1749 if (ses->status == CifsGood) { 1749 if (ses->status == CifsGood) {
1750 xid = GetXid(); 1750 xid = GetXid();
@@ -1841,9 +1841,9 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
1841 goto get_ses_fail; 1841 goto get_ses_fail;
1842 1842
1843 /* success, put it on the list */ 1843 /* success, put it on the list */
1844 write_lock(&cifs_tcp_ses_lock); 1844 spin_lock(&cifs_tcp_ses_lock);
1845 list_add(&ses->smb_ses_list, &server->smb_ses_list); 1845 list_add(&ses->smb_ses_list, &server->smb_ses_list);
1846 write_unlock(&cifs_tcp_ses_lock); 1846 spin_unlock(&cifs_tcp_ses_lock);
1847 1847
1848 FreeXid(xid); 1848 FreeXid(xid);
1849 return ses; 1849 return ses;
@@ -1860,7 +1860,7 @@ cifs_find_tcon(struct cifsSesInfo *ses, const char *unc)
1860 struct list_head *tmp; 1860 struct list_head *tmp;
1861 struct cifsTconInfo *tcon; 1861 struct cifsTconInfo *tcon;
1862 1862
1863 write_lock(&cifs_tcp_ses_lock); 1863 spin_lock(&cifs_tcp_ses_lock);
1864 list_for_each(tmp, &ses->tcon_list) { 1864 list_for_each(tmp, &ses->tcon_list) {
1865 tcon = list_entry(tmp, struct cifsTconInfo, tcon_list); 1865 tcon = list_entry(tmp, struct cifsTconInfo, tcon_list);
1866 if (tcon->tidStatus == CifsExiting) 1866 if (tcon->tidStatus == CifsExiting)
@@ -1869,10 +1869,10 @@ cifs_find_tcon(struct cifsSesInfo *ses, const char *unc)
1869 continue; 1869 continue;
1870 1870
1871 ++tcon->tc_count; 1871 ++tcon->tc_count;
1872 write_unlock(&cifs_tcp_ses_lock); 1872 spin_unlock(&cifs_tcp_ses_lock);
1873 return tcon; 1873 return tcon;
1874 } 1874 }
1875 write_unlock(&cifs_tcp_ses_lock); 1875 spin_unlock(&cifs_tcp_ses_lock);
1876 return NULL; 1876 return NULL;
1877} 1877}
1878 1878
@@ -1883,14 +1883,14 @@ cifs_put_tcon(struct cifsTconInfo *tcon)
1883 struct cifsSesInfo *ses = tcon->ses; 1883 struct cifsSesInfo *ses = tcon->ses;
1884 1884
1885 cFYI(1, "%s: tc_count=%d\n", __func__, tcon->tc_count); 1885 cFYI(1, "%s: tc_count=%d\n", __func__, tcon->tc_count);
1886 write_lock(&cifs_tcp_ses_lock); 1886 spin_lock(&cifs_tcp_ses_lock);
1887 if (--tcon->tc_count > 0) { 1887 if (--tcon->tc_count > 0) {
1888 write_unlock(&cifs_tcp_ses_lock); 1888 spin_unlock(&cifs_tcp_ses_lock);
1889 return; 1889 return;
1890 } 1890 }
1891 1891
1892 list_del_init(&tcon->tcon_list); 1892 list_del_init(&tcon->tcon_list);
1893 write_unlock(&cifs_tcp_ses_lock); 1893 spin_unlock(&cifs_tcp_ses_lock);
1894 1894
1895 xid = GetXid(); 1895 xid = GetXid();
1896 CIFSSMBTDis(xid, tcon); 1896 CIFSSMBTDis(xid, tcon);
@@ -1963,9 +1963,9 @@ cifs_get_tcon(struct cifsSesInfo *ses, struct smb_vol *volume_info)
1963 tcon->nocase = volume_info->nocase; 1963 tcon->nocase = volume_info->nocase;
1964 tcon->local_lease = volume_info->local_lease; 1964 tcon->local_lease = volume_info->local_lease;
1965 1965
1966 write_lock(&cifs_tcp_ses_lock); 1966 spin_lock(&cifs_tcp_ses_lock);
1967 list_add(&tcon->tcon_list, &ses->tcon_list); 1967 list_add(&tcon->tcon_list, &ses->tcon_list);
1968 write_unlock(&cifs_tcp_ses_lock); 1968 spin_unlock(&cifs_tcp_ses_lock);
1969 1969
1970 cifs_fscache_get_super_cookie(tcon); 1970 cifs_fscache_get_super_cookie(tcon);
1971 1971
@@ -3225,9 +3225,9 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
3225 vol_info->secFlg = CIFSSEC_MUST_KRB5; 3225 vol_info->secFlg = CIFSSEC_MUST_KRB5;
3226 3226
3227 /* get a reference for the same TCP session */ 3227 /* get a reference for the same TCP session */
3228 write_lock(&cifs_tcp_ses_lock); 3228 spin_lock(&cifs_tcp_ses_lock);
3229 ++master_tcon->ses->server->srv_count; 3229 ++master_tcon->ses->server->srv_count;
3230 write_unlock(&cifs_tcp_ses_lock); 3230 spin_unlock(&cifs_tcp_ses_lock);
3231 3231
3232 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info); 3232 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info);
3233 if (IS_ERR(ses)) { 3233 if (IS_ERR(ses)) {