diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-04-24 07:57:47 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-04-27 20:36:17 -0400 |
commit | ebe6aa5ac456a13213ed563863e70dd441618a97 (patch) | |
tree | 7703cf9325497f97731fb100a6521821f7fc08f9 | |
parent | d54ff73259a852d4b3886dc586587fdef5e9c8de (diff) |
cifs: eliminate "first_time" parm to CIFS_SessSetup
We can use the is_first_ses_reconnect() function to determine this.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/cifsproto.h | 1 | ||||
-rw-r--r-- | fs/cifs/connect.c | 4 | ||||
-rw-r--r-- | fs/cifs/sess.c | 21 |
3 files changed, 15 insertions, 11 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index cc622a735f29..8e9214275e42 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -95,7 +95,6 @@ extern int small_smb_init_no_tc(const int smb_cmd, const int wct, | |||
95 | struct cifsSesInfo *ses, | 95 | struct cifsSesInfo *ses, |
96 | void **request_buf); | 96 | void **request_buf); |
97 | extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, | 97 | extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, |
98 | const int stage, | ||
99 | const struct nls_table *nls_cp); | 98 | const struct nls_table *nls_cp); |
100 | extern __u16 GetNextMid(struct TCP_Server_Info *server); | 99 | extern __u16 GetNextMid(struct TCP_Server_Info *server); |
101 | extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); | 100 | extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7a47c7c5c7e3..9123c23bd1d9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2878,7 +2878,6 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
2878 | struct nls_table *nls_info) | 2878 | struct nls_table *nls_info) |
2879 | { | 2879 | { |
2880 | int rc = 0; | 2880 | int rc = 0; |
2881 | int first_time = 0; | ||
2882 | struct TCP_Server_Info *server = pSesInfo->server; | 2881 | struct TCP_Server_Info *server = pSesInfo->server; |
2883 | 2882 | ||
2884 | /* what if server changes its buffer size after dropping the session? */ | 2883 | /* what if server changes its buffer size after dropping the session? */ |
@@ -2899,7 +2898,6 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
2899 | spin_unlock(&GlobalMid_Lock); | 2898 | spin_unlock(&GlobalMid_Lock); |
2900 | 2899 | ||
2901 | } | 2900 | } |
2902 | first_time = 1; | ||
2903 | } | 2901 | } |
2904 | 2902 | ||
2905 | if (rc) | 2903 | if (rc) |
@@ -2913,7 +2911,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
2913 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", | 2911 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", |
2914 | server->secMode, server->capabilities, server->timeAdj); | 2912 | server->secMode, server->capabilities, server->timeAdj); |
2915 | 2913 | ||
2916 | rc = CIFS_SessSetup(xid, pSesInfo, first_time, nls_info); | 2914 | rc = CIFS_SessSetup(xid, pSesInfo, nls_info); |
2917 | if (rc) { | 2915 | if (rc) { |
2918 | cERROR(1, "Send error in SessSetup = %d", rc); | 2916 | cERROR(1, "Send error in SessSetup = %d", rc); |
2919 | } else { | 2917 | } else { |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index da9729da03e0..84b92dfaf84c 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -35,9 +35,11 @@ | |||
35 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 35 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
36 | unsigned char *p24); | 36 | unsigned char *p24); |
37 | 37 | ||
38 | /* Checks if this is the first smb session to be reconnected after | 38 | /* |
39 | the socket has been reestablished (so we know whether to use vc 0). | 39 | * Checks if this is the first smb session to be reconnected after |
40 | Called while holding the cifs_tcp_ses_lock, so do not block */ | 40 | * the socket has been reestablished (so we know whether to use vc 0). |
41 | * Called while holding the cifs_tcp_ses_lock, so do not block | ||
42 | */ | ||
41 | static bool is_first_ses_reconnect(struct cifsSesInfo *ses) | 43 | static bool is_first_ses_reconnect(struct cifsSesInfo *ses) |
42 | { | 44 | { |
43 | struct list_head *tmp; | 45 | struct list_head *tmp; |
@@ -447,7 +449,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, | |||
447 | This function returns the length of the data in the blob */ | 449 | This function returns the length of the data in the blob */ |
448 | static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | 450 | static int build_ntlmssp_auth_blob(unsigned char *pbuffer, |
449 | struct cifsSesInfo *ses, | 451 | struct cifsSesInfo *ses, |
450 | const struct nls_table *nls_cp, int first) | 452 | const struct nls_table *nls_cp, bool first) |
451 | { | 453 | { |
452 | AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; | 454 | AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; |
453 | __u32 flags; | 455 | __u32 flags; |
@@ -546,7 +548,7 @@ static void setup_ntlmssp_neg_req(SESSION_SETUP_ANDX *pSMB, | |||
546 | 548 | ||
547 | static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB, | 549 | static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB, |
548 | struct cifsSesInfo *ses, | 550 | struct cifsSesInfo *ses, |
549 | const struct nls_table *nls, int first_time) | 551 | const struct nls_table *nls, bool first_time) |
550 | { | 552 | { |
551 | int bloblen; | 553 | int bloblen; |
552 | 554 | ||
@@ -559,8 +561,8 @@ static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB, | |||
559 | #endif | 561 | #endif |
560 | 562 | ||
561 | int | 563 | int |
562 | CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, | 564 | CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, |
563 | const struct nls_table *nls_cp) | 565 | const struct nls_table *nls_cp) |
564 | { | 566 | { |
565 | int rc = 0; | 567 | int rc = 0; |
566 | int wct; | 568 | int wct; |
@@ -577,10 +579,15 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, | |||
577 | int bytes_remaining; | 579 | int bytes_remaining; |
578 | struct key *spnego_key = NULL; | 580 | struct key *spnego_key = NULL; |
579 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ | 581 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ |
582 | bool first_time; | ||
580 | 583 | ||
581 | if (ses == NULL) | 584 | if (ses == NULL) |
582 | return -EINVAL; | 585 | return -EINVAL; |
583 | 586 | ||
587 | read_lock(&cifs_tcp_ses_lock); | ||
588 | first_time = is_first_ses_reconnect(ses); | ||
589 | read_unlock(&cifs_tcp_ses_lock); | ||
590 | |||
584 | type = ses->server->secType; | 591 | type = ses->server->secType; |
585 | 592 | ||
586 | cFYI(1, "sess setup type %d", type); | 593 | cFYI(1, "sess setup type %d", type); |