[PATCH] cifs: Do not interpret oplock break responses as responses to an unrelated...
authorSteve French <smfrench@austin.rr.com>
Fri, 29 Apr 2005 05:41:07 +0000 (22:41 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 29 Apr 2005 05:41:07 +0000 (22:41 -0700)
.. even if the multiplex ids match.

Signed-off-by: Steve French (sfrench@us.ibm.com)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/cifs/CHANGES
fs/cifs/cifs_debug.c
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/transport.c

index de8858028d64a8a3d3fbbb7bbd7b138d7897d356..de63a0e3f4ce3960f1f6564f73f496533d4cdc24 100644 (file)
@@ -10,6 +10,8 @@ different users from the same client to the same server. Fix oops in
 cifs_close. Add mount option for remapping reserved characters in
 filenames (also allow recognizing files with created by SFU which have any
 of these seven reserved characters, except backslash, to be recognized).
+Fix invalid transact2 message (we were sometimes trying to interpret
+oplock breaks as SMB responses).
 
 Version 1.31
 ------------
index e7bd93e6226d58d9fcb9501671ab8ca2bf7b0820..efa099165b22ea5d52a2d8c454cbbaf201596083 100644 (file)
@@ -111,7 +111,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                                        mid_q_entry,
                                        qhead);
                                if(mid_entry) {
-                                       length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",mid_entry->midState,mid_entry->command,mid_entry->pid,mid_entry->tsk,mid_entry->mid);
+                                       length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",
+                                               mid_entry->midState,
+                                               (int)mid_entry->command,
+                                               mid_entry->pid,
+                                               mid_entry->tsk,
+                                               mid_entry->mid);
                                        buf += length;
                                }
                        }
index 1b3082d79379d872481aa3b109be42f408cb7c3f..fe14097995135d35279d8e6c7e92f9b2a90cca55 100644 (file)
@@ -313,12 +313,12 @@ struct mid_q_entry {
        __u16 mid;              /* multiplex id */
        __u16 pid;              /* process id */
        __u32 sequence_number;  /* for CIFS signing */
-       __u16 command;          /* smb command code */
        struct timeval when_sent;       /* time when smb sent */
        struct cifsSesInfo *ses;        /* smb was sent to this server */
        struct task_struct *tsk;        /* task waiting for response */
        struct smb_hdr *resp_buf;       /* response buffer */
        int midState;   /* wish this were enum but can not pass to wait_event */
+       __u8 command;           /* smb command code */
 };
 
 struct oplock_q_entry {
index 1f22b85324cf479f26b890819af1b53858c282ce..383e55fa7d260687930daeb43b1309f58175de33 100644 (file)
@@ -361,9 +361,13 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                                                               mid_q_entry,
                                                               qhead);
 
-                                       if ((mid_entry->mid == smb_buffer->Mid) && (mid_entry->midState == MID_REQUEST_SUBMITTED)) {
-                                               cFYI(1,
-                                                    (" Mid 0x%x matched - waking up ",mid_entry->mid));
+                                       if ((mid_entry->mid == smb_buffer->Mid)
+                                               && (mid_entry->midState == 
+                                                       MID_REQUEST_SUBMITTED) 
+                                               && (mid_entry->command == 
+                                                       smb_buffer->Command)) {
+                                               cFYI(1,("Found Mid 0x%x wake up"
+                                                       ,mid_entry->mid));
                                                task_to_wake = mid_entry->tsk;
                                                mid_entry->resp_buf =
                                                    smb_buffer;
index a9e4f989b7f744439989125e453017a7f323fa5b..aab62ed4698223d915e5621339b30396d9c38eea 100644 (file)
@@ -189,7 +189,6 @@ smb_sendv(struct socket *ssocket, struct smb_hdr *smb_buffer,
        struct msghdr smb_msg;
        number_of_pages += 1; /* account for SMB header */
        struct kvec * piov  = kmalloc(number_of_pages * sizeof(struct kvec));
-       if(i=0;i<num_pages-1;i++
        unsigned len = smb_buf_length + 4;
 
        if(ssocket == NULL)