diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-05-25 02:43:58 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-07-24 01:33:26 -0400 |
commit | 286170aa241819f39d9d1d5d9f2434cfb8519506 (patch) | |
tree | f7f4a8fd6eb653ac0f40cab9e8468462316fe41e /fs/cifs/connect.c | |
parent | a891f0f895f4a760fdb99636fab05e60597b8224 (diff) |
CIFS: Move protocol specific negotiate code to ops struct
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 6d846e7624d0..03389f59390f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -407,7 +407,7 @@ cifs_echo_request(struct work_struct *work) | |||
407 | * done, which is indicated by maxBuf != 0. Also, no need to ping if | 407 | * done, which is indicated by maxBuf != 0. Also, no need to ping if |
408 | * we got a response recently | 408 | * we got a response recently |
409 | */ | 409 | */ |
410 | if (server->maxBuf == 0 || | 410 | if (!server->ops->need_neg || server->ops->need_neg(server) || |
411 | time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) | 411 | time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) |
412 | goto requeue_echo; | 412 | goto requeue_echo; |
413 | 413 | ||
@@ -2406,7 +2406,8 @@ static bool warned_on_ntlm; /* globals init to false automatically */ | |||
2406 | static struct cifs_ses * | 2406 | static struct cifs_ses * |
2407 | cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | 2407 | cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) |
2408 | { | 2408 | { |
2409 | int rc = -ENOMEM, xid; | 2409 | int rc = -ENOMEM; |
2410 | unsigned int xid; | ||
2410 | struct cifs_ses *ses; | 2411 | struct cifs_ses *ses; |
2411 | struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr; | 2412 | struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr; |
2412 | struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr; | 2413 | struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr; |
@@ -3960,24 +3961,22 @@ cifs_umount(struct cifs_sb_info *cifs_sb) | |||
3960 | kfree(cifs_sb); | 3961 | kfree(cifs_sb); |
3961 | } | 3962 | } |
3962 | 3963 | ||
3963 | int cifs_negotiate_protocol(unsigned int xid, struct cifs_ses *ses) | 3964 | int |
3965 | cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses) | ||
3964 | { | 3966 | { |
3965 | int rc = 0; | 3967 | int rc = 0; |
3966 | struct TCP_Server_Info *server = ses->server; | 3968 | struct TCP_Server_Info *server = ses->server; |
3967 | 3969 | ||
3970 | if (!server->ops->need_neg || !server->ops->negotiate) | ||
3971 | return -ENOSYS; | ||
3972 | |||
3968 | /* only send once per connect */ | 3973 | /* only send once per connect */ |
3969 | if (server->maxBuf != 0) | 3974 | if (!server->ops->need_neg(server)) |
3970 | return 0; | 3975 | return 0; |
3971 | 3976 | ||
3972 | set_credits(server, 1); | 3977 | set_credits(server, 1); |
3973 | rc = CIFSSMBNegotiate(xid, ses); | 3978 | |
3974 | if (rc == -EAGAIN) { | 3979 | rc = server->ops->negotiate(xid, ses); |
3975 | /* retry only once on 1st time connection */ | ||
3976 | set_credits(server, 1); | ||
3977 | rc = CIFSSMBNegotiate(xid, ses); | ||
3978 | if (rc == -EAGAIN) | ||
3979 | rc = -EHOSTDOWN; | ||
3980 | } | ||
3981 | if (rc == 0) { | 3980 | if (rc == 0) { |
3982 | spin_lock(&GlobalMid_Lock); | 3981 | spin_lock(&GlobalMid_Lock); |
3983 | if (server->tcpStatus == CifsNeedNegotiate) | 3982 | if (server->tcpStatus == CifsNeedNegotiate) |
@@ -3985,7 +3984,6 @@ int cifs_negotiate_protocol(unsigned int xid, struct cifs_ses *ses) | |||
3985 | else | 3984 | else |
3986 | rc = -EHOSTDOWN; | 3985 | rc = -EHOSTDOWN; |
3987 | spin_unlock(&GlobalMid_Lock); | 3986 | spin_unlock(&GlobalMid_Lock); |
3988 | |||
3989 | } | 3987 | } |
3990 | 3988 | ||
3991 | return rc; | 3989 | return rc; |