aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/connect.c6
-rw-r--r--fs/cifs/transport.c28
3 files changed, 18 insertions, 18 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 82e28f5515c8..9b002cca6bb7 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -151,7 +151,7 @@ struct TCP_Server_Info {
151 atomic_t num_waiters; /* blocked waiting to get in sendrecv */ 151 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
152#endif 152#endif
153 enum statusEnum tcpStatus; /* what we think the status is */ 153 enum statusEnum tcpStatus; /* what we think the status is */
154 struct semaphore tcpSem; 154 struct mutex srv_mutex;
155 struct task_struct *tsk; 155 struct task_struct *tsk;
156 char server_GUID[16]; 156 char server_GUID[16];
157 char secMode; 157 char secMode;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 701daf411a4b..61b68a0ee2ff 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -156,7 +156,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
156 } 156 }
157 read_unlock(&cifs_tcp_ses_lock); 157 read_unlock(&cifs_tcp_ses_lock);
158 /* do not want to be sending data on a socket we are freeing */ 158 /* do not want to be sending data on a socket we are freeing */
159 down(&server->tcpSem); 159 mutex_lock(&server->srv_mutex);
160 if (server->ssocket) { 160 if (server->ssocket) {
161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state, 161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
162 server->ssocket->flags)); 162 server->ssocket->flags));
@@ -182,7 +182,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
182 } 182 }
183 } 183 }
184 spin_unlock(&GlobalMid_Lock); 184 spin_unlock(&GlobalMid_Lock);
185 up(&server->tcpSem); 185 mutex_unlock(&server->srv_mutex);
186 186
187 while ((server->tcpStatus != CifsExiting) && 187 while ((server->tcpStatus != CifsExiting) &&
188 (server->tcpStatus != CifsGood)) { 188 (server->tcpStatus != CifsGood)) {
@@ -2175,7 +2175,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2175 to the struct since the kernel thread not created yet 2175 to the struct since the kernel thread not created yet
2176 so no need to spinlock this init of tcpStatus */ 2176 so no need to spinlock this init of tcpStatus */
2177 srvTcp->tcpStatus = CifsNew; 2177 srvTcp->tcpStatus = CifsNew;
2178 init_MUTEX(&srvTcp->tcpSem); 2178 mutex_init(&srvTcp->srv_mutex);
2179 2179
2180 /* 2180 /*
2181 * since we're in a cifs function already, we know that 2181 * since we're in a cifs function already, we know that
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 8e0d1c397c73..cd4ed65d6cd9 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -516,11 +516,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
516 and avoid races inside tcp sendmsg code that could cause corruption 516 and avoid races inside tcp sendmsg code that could cause corruption
517 of smb data */ 517 of smb data */
518 518
519 down(&ses->server->tcpSem); 519 mutex_lock(&ses->server->srv_mutex);
520 520
521 rc = allocate_mid(ses, in_buf, &midQ); 521 rc = allocate_mid(ses, in_buf, &midQ);
522 if (rc) { 522 if (rc) {
523 up(&ses->server->tcpSem); 523 mutex_unlock(&ses->server->srv_mutex);
524 cifs_small_buf_release(in_buf); 524 cifs_small_buf_release(in_buf);
525 /* Update # of requests on wire to server */ 525 /* Update # of requests on wire to server */
526 atomic_dec(&ses->server->inFlight); 526 atomic_dec(&ses->server->inFlight);
@@ -541,7 +541,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
541 midQ->when_sent = jiffies; 541 midQ->when_sent = jiffies;
542#endif 542#endif
543 543
544 up(&ses->server->tcpSem); 544 mutex_unlock(&ses->server->srv_mutex);
545 cifs_small_buf_release(in_buf); 545 cifs_small_buf_release(in_buf);
546 546
547 if (rc < 0) 547 if (rc < 0)
@@ -698,11 +698,11 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
698 and avoid races inside tcp sendmsg code that could cause corruption 698 and avoid races inside tcp sendmsg code that could cause corruption
699 of smb data */ 699 of smb data */
700 700
701 down(&ses->server->tcpSem); 701 mutex_lock(&ses->server->srv_mutex);
702 702
703 rc = allocate_mid(ses, in_buf, &midQ); 703 rc = allocate_mid(ses, in_buf, &midQ);
704 if (rc) { 704 if (rc) {
705 up(&ses->server->tcpSem); 705 mutex_unlock(&ses->server->srv_mutex);
706 /* Update # of requests on wire to server */ 706 /* Update # of requests on wire to server */
707 atomic_dec(&ses->server->inFlight); 707 atomic_dec(&ses->server->inFlight);
708 wake_up(&ses->server->request_q); 708 wake_up(&ses->server->request_q);
@@ -713,7 +713,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
713 cERROR(1, ("Illegal length, greater than maximum frame, %d", 713 cERROR(1, ("Illegal length, greater than maximum frame, %d",
714 in_buf->smb_buf_length)); 714 in_buf->smb_buf_length));
715 DeleteMidQEntry(midQ); 715 DeleteMidQEntry(midQ);
716 up(&ses->server->tcpSem); 716 mutex_unlock(&ses->server->srv_mutex);
717 /* Update # of requests on wire to server */ 717 /* Update # of requests on wire to server */
718 atomic_dec(&ses->server->inFlight); 718 atomic_dec(&ses->server->inFlight);
719 wake_up(&ses->server->request_q); 719 wake_up(&ses->server->request_q);
@@ -733,7 +733,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
733 atomic_dec(&ses->server->inSend); 733 atomic_dec(&ses->server->inSend);
734 midQ->when_sent = jiffies; 734 midQ->when_sent = jiffies;
735#endif 735#endif
736 up(&ses->server->tcpSem); 736 mutex_unlock(&ses->server->srv_mutex);
737 737
738 if (rc < 0) 738 if (rc < 0)
739 goto out; 739 goto out;
@@ -861,16 +861,16 @@ send_nt_cancel(struct cifsTconInfo *tcon, struct smb_hdr *in_buf,
861 861
862 header_assemble(in_buf, SMB_COM_NT_CANCEL, tcon, 0); 862 header_assemble(in_buf, SMB_COM_NT_CANCEL, tcon, 0);
863 in_buf->Mid = mid; 863 in_buf->Mid = mid;
864 down(&ses->server->tcpSem); 864 mutex_lock(&ses->server->srv_mutex);
865 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); 865 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number);
866 if (rc) { 866 if (rc) {
867 up(&ses->server->tcpSem); 867 mutex_unlock(&ses->server->srv_mutex);
868 return rc; 868 return rc;
869 } 869 }
870 rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 870 rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
871 (struct sockaddr *) &(ses->server->addr.sockAddr), 871 (struct sockaddr *) &(ses->server->addr.sockAddr),
872 ses->server->noblocksnd); 872 ses->server->noblocksnd);
873 up(&ses->server->tcpSem); 873 mutex_unlock(&ses->server->srv_mutex);
874 return rc; 874 return rc;
875} 875}
876 876
@@ -936,16 +936,16 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
936 and avoid races inside tcp sendmsg code that could cause corruption 936 and avoid races inside tcp sendmsg code that could cause corruption
937 of smb data */ 937 of smb data */
938 938
939 down(&ses->server->tcpSem); 939 mutex_lock(&ses->server->srv_mutex);
940 940
941 rc = allocate_mid(ses, in_buf, &midQ); 941 rc = allocate_mid(ses, in_buf, &midQ);
942 if (rc) { 942 if (rc) {
943 up(&ses->server->tcpSem); 943 mutex_unlock(&ses->server->srv_mutex);
944 return rc; 944 return rc;
945 } 945 }
946 946
947 if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { 947 if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
948 up(&ses->server->tcpSem); 948 mutex_unlock(&ses->server->srv_mutex);
949 cERROR(1, ("Illegal length, greater than maximum frame, %d", 949 cERROR(1, ("Illegal length, greater than maximum frame, %d",
950 in_buf->smb_buf_length)); 950 in_buf->smb_buf_length));
951 DeleteMidQEntry(midQ); 951 DeleteMidQEntry(midQ);
@@ -965,7 +965,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
965 atomic_dec(&ses->server->inSend); 965 atomic_dec(&ses->server->inSend);
966 midQ->when_sent = jiffies; 966 midQ->when_sent = jiffies;
967#endif 967#endif
968 up(&ses->server->tcpSem); 968 mutex_unlock(&ses->server->srv_mutex);
969 969
970 if (rc < 0) { 970 if (rc < 0) {
971 DeleteMidQEntry(midQ); 971 DeleteMidQEntry(midQ);