diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-07 11:30:28 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-09 18:38:20 -0500 |
commit | a0f8b4fb4cab4bc32caaf34fc0a0c9d5dd369186 (patch) | |
tree | 2a49df40e7d76028155f7ced04d03e5acd402f68 /fs | |
parent | 197a1eeb7f89c1d2ba93713398e9655899aa973e (diff) |
cifs: remove unnecessary locking around sequence_number
The server->sequence_number is already protected by the srv_mutex. The
GlobalMid_lock is unneeded here.
Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsencrypt.c | 6 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index f856732161ab..66f3d50d0676 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -72,6 +72,7 @@ static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | /* must be called with server->srv_mutex held */ | ||
75 | int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | 76 | int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, |
76 | __u32 *pexpected_response_sequence_number) | 77 | __u32 *pexpected_response_sequence_number) |
77 | { | 78 | { |
@@ -84,14 +85,12 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | |||
84 | if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) | 85 | if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) |
85 | return rc; | 86 | return rc; |
86 | 87 | ||
87 | spin_lock(&GlobalMid_Lock); | ||
88 | cifs_pdu->Signature.Sequence.SequenceNumber = | 88 | cifs_pdu->Signature.Sequence.SequenceNumber = |
89 | cpu_to_le32(server->sequence_number); | 89 | cpu_to_le32(server->sequence_number); |
90 | cifs_pdu->Signature.Sequence.Reserved = 0; | 90 | cifs_pdu->Signature.Sequence.Reserved = 0; |
91 | 91 | ||
92 | *pexpected_response_sequence_number = server->sequence_number++; | 92 | *pexpected_response_sequence_number = server->sequence_number++; |
93 | server->sequence_number++; | 93 | server->sequence_number++; |
94 | spin_unlock(&GlobalMid_Lock); | ||
95 | 94 | ||
96 | rc = cifs_calculate_signature(cifs_pdu, server, smb_signature); | 95 | rc = cifs_calculate_signature(cifs_pdu, server, smb_signature); |
97 | if (rc) | 96 | if (rc) |
@@ -149,6 +148,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
149 | return rc; | 148 | return rc; |
150 | } | 149 | } |
151 | 150 | ||
151 | /* must be called with server->srv_mutex held */ | ||
152 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | 152 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, |
153 | __u32 *pexpected_response_sequence_number) | 153 | __u32 *pexpected_response_sequence_number) |
154 | { | 154 | { |
@@ -162,14 +162,12 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | |||
162 | if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) | 162 | if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) |
163 | return rc; | 163 | return rc; |
164 | 164 | ||
165 | spin_lock(&GlobalMid_Lock); | ||
166 | cifs_pdu->Signature.Sequence.SequenceNumber = | 165 | cifs_pdu->Signature.Sequence.SequenceNumber = |
167 | cpu_to_le32(server->sequence_number); | 166 | cpu_to_le32(server->sequence_number); |
168 | cifs_pdu->Signature.Sequence.Reserved = 0; | 167 | cifs_pdu->Signature.Sequence.Reserved = 0; |
169 | 168 | ||
170 | *pexpected_response_sequence_number = server->sequence_number++; | 169 | *pexpected_response_sequence_number = server->sequence_number++; |
171 | server->sequence_number++; | 170 | server->sequence_number++; |
172 | spin_unlock(&GlobalMid_Lock); | ||
173 | 171 | ||
174 | rc = cifs_calc_signature2(iov, n_vec, server, smb_signature); | 172 | rc = cifs_calc_signature2(iov, n_vec, server, smb_signature); |
175 | if (rc) | 173 | if (rc) |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index dfd2d46275ab..e6590e69fb0e 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -207,7 +207,7 @@ struct TCP_Server_Info { | |||
207 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ | 207 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ |
208 | /* 16th byte of RFC1001 workstation name is always null */ | 208 | /* 16th byte of RFC1001 workstation name is always null */ |
209 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; | 209 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; |
210 | __u32 sequence_number; /* needed for CIFS PDU signature */ | 210 | __u32 sequence_number; /* for signing, protected by srv_mutex */ |
211 | struct session_key session_key; | 211 | struct session_key session_key; |
212 | unsigned long lstrp; /* when we got last response from this server */ | 212 | unsigned long lstrp; /* when we got last response from this server */ |
213 | u16 dialect; /* dialect index that server chose */ | 213 | u16 dialect; /* dialect index that server chose */ |