summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
authorPavel Shilovsky2011-12-27 13:12:43 +0100
committerPavel Shilovsky2012-07-24 19:54:55 +0200
commitec2e4523fdba88317e06d0c7a88af3a0860447fc (patch)
tree474781811d075dfb2e01345911fd0ff585f2d64a /fs/cifs/smb2ops.c
parentCIFS: Respect SMB2 header/max header size (diff)
downloadkernel-qcow2-linux-ec2e4523fdba88317e06d0c7a88af3a0860447fc.tar.gz
kernel-qcow2-linux-ec2e4523fdba88317e06d0c7a88af3a0860447fc.tar.xz
kernel-qcow2-linux-ec2e4523fdba88317e06d0c7a88af3a0860447fc.zip
CIFS: Add capability to send SMB2 negotiate message
and add negotiate request type to let set_credits know that we are only on negotiate stage and no need to make a decision about disabling echos and oplocks. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c6f81541a635..2b5232b4f7e7 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -61,7 +61,7 @@ smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add,
val = server->ops->get_credits_field(server, optype);
*val += add;
server->in_flight--;
- if (server->in_flight == 0)
+ if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
rc = change_conf(server);
spin_unlock(&server->req_lock);
wake_up(&server->request_q);
@@ -139,6 +139,24 @@ smb2_dump_detail(void *buf)
#endif
}
+static bool
+smb2_need_neg(struct TCP_Server_Info *server)
+{
+ return server->max_read == 0;
+}
+
+static int
+smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
+{
+ int rc;
+ ses->server->CurrentMid = 0;
+ rc = SMB2_negotiate(xid, ses);
+ /* BB we probably don't need to retry with modern servers */
+ if (rc == -EAGAIN)
+ rc = -EHOSTDOWN;
+ return rc;
+}
+
struct smb_version_operations smb21_operations = {
.setup_request = smb2_setup_request,
.check_receive = smb2_check_receive,
@@ -150,6 +168,8 @@ struct smb_version_operations smb21_operations = {
.find_mid = smb2_find_mid,
.check_message = smb2_check_message,
.dump_detail = smb2_dump_detail,
+ .need_neg = smb2_need_neg,
+ .negotiate = smb2_negotiate,
};
struct smb_version_values smb21_values = {