aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2008-12-01 07:09:36 -0500
committerSteve French <sfrench@us.ibm.com>2008-12-25 21:29:09 -0500
commit72ca545b2d83ac7de671bf66d2dbc214528b4c0c (patch)
tree660fd7308d20a6e3dd30789d0107393cca0c9464 /fs/cifs/transport.c
parent0468a2cf914e79442b8309ce62e3f861599d8cab (diff)
cifs: convert tcpSem to a mutex
Mutexes are preferred for single-holder semaphores... Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c28
1 files changed, 14 insertions, 14 deletions
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);