v2.6.22.21-op1-rc2
[linux-2.6.22.y-op-patches.git] / patch-2.6.22.y / patch-v2.6.22.20-op1-v2.6.22.21-op1-rc2
blobbb44aa4846400a69002b4acd644bf2ea7cdfb5d3
1 diff --git a/Makefile b/Makefile
2 index 4fdef51..1083af5 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6  VERSION = 2
7  PATCHLEVEL = 6
8  SUBLEVEL = 22
9 -EXTRAVERSION = .20-op1
10 +EXTRAVERSION = .21-op1-rc2
11  NAME = Holy Dancing Manatees, Batman!
13  # *DOCUMENTATION*
14 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
15 index 061375e..81ed88f 100644
16 --- a/drivers/md/raid5.c
17 +++ b/drivers/md/raid5.c
18 @@ -2525,7 +2525,8 @@ static void raid5_activate_delayed(raid5_conf_t *conf)
19                                 atomic_inc(&conf->preread_active_stripes);
20                         list_add_tail(&sh->lru, &conf->handle_list);
21                 }
22 -       }
23 +       } else
24 +               blk_plug_device(conf->mddev->queue);
25  }
27  static void activate_bit_delay(raid5_conf_t *conf)
28 @@ -2949,7 +2950,8 @@ static int make_request(request_queue_t *q, struct bio * bi)
29                                 goto retry;
30                         }
31                         finish_wait(&conf->wait_for_overlap, &w);
32 -                       handle_stripe(sh, NULL);
33 +                       set_bit(STRIPE_HANDLE, &sh->state);
34 +                       clear_bit(STRIPE_DELAYED, &sh->state);
35                         release_stripe(sh);
36                 } else {
37                         /* cannot get stripe for read-ahead, just give-up */
38 @@ -3267,7 +3269,7 @@ static int  retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
39   * During the scan, completed stripes are saved for us by the interrupt
40   * handler, so that they will not have to wait for our next wakeup.
41   */
42 -static void raid5d (mddev_t *mddev)
43 +static void raid5d(mddev_t *mddev)
44  {
45         struct stripe_head *sh;
46         raid5_conf_t *conf = mddev_to_conf(mddev);
47 @@ -3292,12 +3294,6 @@ static void raid5d (mddev_t *mddev)
48                         activate_bit_delay(conf);
49                 }
51 -               if (list_empty(&conf->handle_list) &&
52 -                   atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD &&
53 -                   !blk_queue_plugged(mddev->queue) &&
54 -                   !list_empty(&conf->delayed_list))
55 -                       raid5_activate_delayed(conf);
57                 while ((bio = remove_bio_from_retry(conf))) {
58                         int ok;
59                         spin_unlock_irq(&conf->device_lock);
60 diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
61 index 041af63..4df0284 100644
62 --- a/drivers/net/tulip/tulip_core.c
63 +++ b/drivers/net/tulip/tulip_core.c
64 @@ -1794,6 +1794,10 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev)
65                 return;
67         tp = netdev_priv(dev);
69 +       /* shoot NIC in the head before deallocating descriptors */
70 +       pci_disable_device(tp->pdev);
72         unregister_netdev(dev);
73         pci_free_consistent (pdev,
74                              sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
75 diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
76 index 07838b2..d05c108 100644
77 --- a/fs/cifs/cifs_debug.c
78 +++ b/fs/cifs/cifs_debug.c
79 @@ -901,90 +901,14 @@ security_flags_write(struct file *file, const char __user *buffer,
80         }
81         /* flags look ok - update the global security flags for cifs module */
82         extended_security = flags;
83 +       if (extended_security & CIFSSEC_MUST_SIGN) {
84 +               /* requiring signing implies signing is allowed */
85 +               extended_security |= CIFSSEC_MAY_SIGN;
86 +               cFYI(1, ("packet signing now required"));
87 +       } else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) {
88 +               cFYI(1, ("packet signing disabled"));
89 +       }
90 +       /* BB should we turn on MAY flags for other MUST options? */
91         return count;
92  }
94 -/* static int
95 -ntlmv2_enabled_read(char *page, char **start, off_t off,
96 -                      int count, int *eof, void *data)
98 -       int len;
100 -       len = sprintf(page, "%d\n", ntlmv2_support);
102 -       len -= off;
103 -       *start = page + off;
105 -       if (len > count)
106 -               len = count;
107 -       else
108 -               *eof = 1;
110 -       if (len < 0)
111 -               len = 0;
113 -       return len;
115 -static int
116 -ntlmv2_enabled_write(struct file *file, const char __user *buffer,
117 -                       unsigned long count, void *data)
119 -       char c;
120 -       int rc;
122 -       rc = get_user(c, buffer);
123 -       if (rc)
124 -               return rc;
125 -       if (c == '0' || c == 'n' || c == 'N')
126 -               ntlmv2_support = 0;
127 -       else if (c == '1' || c == 'y' || c == 'Y')
128 -               ntlmv2_support = 1;
129 -       else if (c == '2')
130 -               ntlmv2_support = 2;
132 -       return count;
135 -static int
136 -packet_signing_enabled_read(char *page, char **start, off_t off,
137 -                      int count, int *eof, void *data)
139 -       int len;
141 -       len = sprintf(page, "%d\n", sign_CIFS_PDUs);
143 -       len -= off;
144 -       *start = page + off;
146 -       if (len > count)
147 -               len = count;
148 -       else
149 -               *eof = 1;
151 -       if (len < 0)
152 -               len = 0;
154 -       return len;
156 -static int
157 -packet_signing_enabled_write(struct file *file, const char __user *buffer,
158 -                       unsigned long count, void *data)
160 -       char c;
161 -       int rc;
163 -       rc = get_user(c, buffer);
164 -       if (rc)
165 -               return rc;
166 -       if (c == '0' || c == 'n' || c == 'N')
167 -               sign_CIFS_PDUs = 0;
168 -       else if (c == '1' || c == 'y' || c == 'Y')
169 -               sign_CIFS_PDUs = 1;
170 -       else if (c == '2')
171 -               sign_CIFS_PDUs = 2;
173 -       return count;
174 -} */
177  #endif
178 diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
179 index 23655de..5d6f120 100644
180 --- a/fs/cifs/cifsglob.h
181 +++ b/fs/cifs/cifsglob.h
182 @@ -442,6 +442,17 @@ struct dir_notify_req {
183  #define   CIFS_LARGE_BUFFER     2
184  #define   CIFS_IOVEC            4    /* array of response buffers */
186 +/* Type of Request to SendReceive2 */
187 +#define   CIFS_STD_OP          0    /* normal request timeout */
188 +#define   CIFS_LONG_OP          1    /* long op (up to 45 sec, oplock time) */
189 +#define   CIFS_VLONG_OP         2    /* sloow op - can take up to 180 seconds */
190 +#define   CIFS_BLOCKING_OP      4    /* operation can block */
191 +#define   CIFS_ASYNC_OP         8    /* do not wait for response */
192 +#define   CIFS_TIMEOUT_MASK 0x00F    /* only one of 5 above set in req */
193 +#define   CIFS_LOG_ERROR    0x010    /* log NT STATUS if non-zero */
194 +#define   CIFS_LARGE_BUF_OP 0x020    /* large request buffer */
195 +#define   CIFS_NO_RESP      0x040    /* no response buffer required */
197  /* Security Flags: indicate type of session setup needed */
198  #define   CIFSSEC_MAY_SIGN     0x00001
199  #define   CIFSSEC_MAY_NTLM     0x00002
200 diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
201 index 5d163e2..f324ccc 100644
202 --- a/fs/cifs/cifsproto.h
203 +++ b/fs/cifs/cifsproto.h
204 @@ -48,9 +48,11 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
205                         struct smb_hdr * /* input */ ,
206                         struct smb_hdr * /* out */ ,
207                         int * /* bytes returned */ , const int long_op);
208 +extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
209 +                       struct smb_hdr *in_buf, int flags);
210  extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *,
211                         struct kvec *, int /* nvec to send */, 
212 -                       int * /* type of buf returned */ , const int long_op);
213 +                       int * /* type of buf returned */ , const int flags);
214  extern int SendReceiveBlockingLock(const unsigned int /* xid */ , 
215                                         struct cifsTconInfo *,
216                                 struct smb_hdr * /* input */ ,
217 diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
218 index 57419a1..db8d110 100644
219 --- a/fs/cifs/cifssmb.c
220 +++ b/fs/cifs/cifssmb.c
221 @@ -426,11 +426,11 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
223         /* if any of auth flags (ie not sign or seal) are overriden use them */
224         if(ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL)))
225 -               secFlags = ses->overrideSecFlg;
226 +               secFlags = ses->overrideSecFlg; /* BB FIXME fix sign flags? */
227         else /* if override flags set only sign/seal OR them with global auth */
228                 secFlags = extended_security | ses->overrideSecFlg;
230 -       cFYI(1,("secFlags 0x%x",secFlags));
231 +       cFYI(1, ("secFlags 0x%x", secFlags));
233         pSMB->hdr.Mid = GetNextMid(server);
234         pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
235 @@ -633,22 +633,32 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
236  #ifdef CONFIG_CIFS_WEAK_PW_HASH
237  signing_check:
238  #endif
239 -       if(sign_CIFS_PDUs == FALSE) {        
240 +       if ((secFlags & CIFSSEC_MAY_SIGN) == 0) {
241 +               /* MUST_SIGN already includes the MAY_SIGN FLAG
242 +                  so if this is zero it means that signing is disabled */
243 +               cFYI(1, ("Signing disabled"));
244                 if(server->secMode & SECMODE_SIGN_REQUIRED)
245 -                       cERROR(1,("Server requires "
246 -                                "/proc/fs/cifs/PacketSigningEnabled to be on"));
247 +                       cERROR(1, ("Server requires "
248 +                                "/proc/fs/cifs/PacketSigningEnabled "
249 +                                "to be on"));
250                 server->secMode &= 
251                         ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED);
252 -       } else if(sign_CIFS_PDUs == 1) {
253 +       } else if ((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) {
254 +               /* signing required */
255 +               cFYI(1, ("Must sign - secFlags 0x%x", secFlags));
256 +               if((server->secMode &
257 +                       (SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED)) == 0) {
258 +                       cERROR(1,
259 +                               ("signing required but server lacks support"));
260 +               } else
261 +                       server->secMode |= SECMODE_SIGN_REQUIRED;
262 +       } else {
263 +               /* signing optional ie CIFSSEC_MAY_SIGN */
264                 if((server->secMode & SECMODE_SIGN_REQUIRED) == 0)
265 -                       server->secMode &= 
266 +                       server->secMode &=
267                                 ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED);
268 -       } else if(sign_CIFS_PDUs == 2) {
269 -               if((server->secMode & 
270 -                       (SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED)) == 0) {
271 -                       cERROR(1,("signing required but server lacks support"));
272 -               }
273         }
275  neg_err_exit:  
276         cifs_buf_release(pSMB);
278 @@ -660,9 +670,7 @@ int
279  CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
281         struct smb_hdr *smb_buffer;
282 -       struct smb_hdr *smb_buffer_response; /* BB removeme BB */
283         int rc = 0;
284 -       int length;
286         cFYI(1, ("In tree disconnect"));
287         /*
288 @@ -699,16 +707,12 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
289         if (rc) {
290                 up(&tcon->tconSem);
291                 return rc;
292 -       } else {
293 -               smb_buffer_response = smb_buffer; /* BB removeme BB */
294         }
295 -       rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response,
296 -                        &length, 0);
298 +       rc = SendReceiveNoRsp(xid, tcon->ses, smb_buffer, 0);
299         if (rc)
300                 cFYI(1, ("Tree disconnect failed %d", rc));
302 -       if (smb_buffer)
303 -               cifs_small_buf_release(smb_buffer);
304         up(&tcon->tconSem);
306         /* No need to return error on this operation if tid invalidated and 
307 @@ -722,10 +726,8 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
308  int
309  CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
311 -       struct smb_hdr *smb_buffer_response;
312         LOGOFF_ANDX_REQ *pSMB;
313         int rc = 0;
314 -       int length;
316         cFYI(1, ("In SMBLogoff for session disconnect"));
317         if (ses)
318 @@ -744,8 +746,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
319                 return rc;
320         }
322 -       smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */
323 -       
324         if(ses->server) {
325                 pSMB->hdr.Mid = GetNextMid(ses->server);
327 @@ -757,8 +757,7 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
328         pSMB->hdr.Uid = ses->Suid;
330         pSMB->AndXCommand = 0xFF;
331 -       rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
332 -                        smb_buffer_response, &length, 0);
333 +       rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
334         if (ses->server) {
335                 atomic_dec(&ses->server->socketUseCount);
336                 if (atomic_read(&ses->server->socketUseCount) == 0) {
337 @@ -769,7 +768,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
338                 }
339         }
340         up(&ses->sesSem);
341 -       cifs_small_buf_release(pSMB);
343         /* if session dead then we do not need to do ulogoff,
344                 since server closed smb session, no sense reporting 
345 @@ -1143,7 +1141,7 @@ OldOpenRetry:
346         pSMB->ByteCount = cpu_to_le16(count);
347         /* long_op set to 1 to allow for oplock break timeouts */
348         rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
349 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 1);
350 +                       (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
351         cifs_stats_inc(&tcon->num_opens);
352         if (rc) {
353                 cFYI(1, ("Error in Open = %d", rc));
354 @@ -1257,7 +1255,7 @@ openRetry:
355         pSMB->ByteCount = cpu_to_le16(count);
356         /* long_op set to 1 to allow for oplock break timeouts */
357         rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
358 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 1);
359 +                       (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
360         cifs_stats_inc(&tcon->num_opens);
361         if (rc) {
362                 cFYI(1, ("Error in Open = %d", rc));
363 @@ -1337,7 +1335,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
364         iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
365         rc = SendReceive2(xid, tcon->ses, iov, 
366                           1 /* num iovecs */,
367 -                         &resp_buf_type, 0); 
368 +                        &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR);
369         cifs_stats_inc(&tcon->num_reads);
370         pSMBr = (READ_RSP *)iov[0].iov_base;
371         if (rc) {
372 @@ -1596,7 +1594,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
373         int timeout = 0;
374         __u16 count;
376 -       cFYI(1, ("In CIFSSMBLock - timeout %d numLock %d",waitFlag,numLock));
377 +       cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock));
378         rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
380         if (rc)
381 @@ -1605,10 +1603,10 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
382         pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */
384         if(lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
385 -               timeout = -1; /* no response expected */
386 +               timeout = CIFS_ASYNC_OP; /* no response expected */
387                 pSMB->Timeout = 0;
388         } else if (waitFlag == TRUE) {
389 -               timeout = 3;  /* blocking operation, no timeout */
390 +               timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
391                 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
392         } else {
393                 pSMB->Timeout = 0;
394 @@ -1638,15 +1636,16 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
395         if (waitFlag) {
396                 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
397                         (struct smb_hdr *) pSMBr, &bytes_returned);
398 +               cifs_small_buf_release(pSMB);
399         } else {
400 -               rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
401 -                        (struct smb_hdr *) pSMBr, &bytes_returned, timeout);
402 +               rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *)pSMB,
403 +                                     timeout);
404 +               /* SMB buffer freed by function above */
405         }
406         cifs_stats_inc(&tcon->num_locks);
407         if (rc) {
408                 cFYI(1, ("Send error in Lock = %d", rc));
409         }
410 -       cifs_small_buf_release(pSMB);
412         /* Note: On -EAGAIN error only caller can retry on handle based calls 
413         since file handle passed in no longer valid */
414 @@ -1666,7 +1665,9 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
415         int rc = 0;
416         int timeout = 0;
417         int bytes_returned = 0;
418 +       int resp_buf_type = 0;
419         __u16 params, param_offset, offset, byte_count, count;
420 +       struct kvec iov[1];
422         cFYI(1, ("Posix Lock"));
424 @@ -1710,7 +1711,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
426         parm_data->lock_type = cpu_to_le16(lock_type);
427         if(waitFlag) {
428 -               timeout = 3;  /* blocking operation, no timeout */
429 +               timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
430                 parm_data->lock_flags = cpu_to_le16(1);
431                 pSMB->Timeout = cpu_to_le32(-1);
432         } else
433 @@ -1730,8 +1731,13 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
434                 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
435                         (struct smb_hdr *) pSMBr, &bytes_returned);
436         } else {
437 -               rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
438 -                       (struct smb_hdr *) pSMBr, &bytes_returned, timeout);
439 +               iov[0].iov_base = (char *)pSMB;
440 +               iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
441 +               rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
442 +                               &resp_buf_type, timeout);
443 +               pSMB = NULL; /* request buf already freed by SendReceive2. Do
444 +                               not try to free it twice below on exit */
445 +               pSMBr = (struct smb_com_transaction2_sfi_rsp *)iov[0].iov_base;
446         }
448         if (rc) {
449 @@ -1766,6 +1772,11 @@ plk_err_exit:
450         if (pSMB)
451                 cifs_small_buf_release(pSMB);
453 +       if (resp_buf_type == CIFS_SMALL_BUFFER)
454 +               cifs_small_buf_release(iov[0].iov_base);
455 +       else if (resp_buf_type == CIFS_LARGE_BUFFER)
456 +               cifs_buf_release(iov[0].iov_base);
458         /* Note: On -EAGAIN error only caller can retry on handle based calls
459            since file handle passed in no longer valid */
461 @@ -1778,8 +1789,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
463         int rc = 0;
464         CLOSE_REQ *pSMB = NULL;
465 -       CLOSE_RSP *pSMBr = NULL;
466 -       int bytes_returned;
467         cFYI(1, ("In CIFSSMBClose"));
469  /* do not retry on dead session on close */
470 @@ -1789,13 +1798,10 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
471         if (rc)
472                 return rc;
474 -       pSMBr = (CLOSE_RSP *)pSMB; /* BB removeme BB */
476         pSMB->FileID = (__u16) smb_file_id;
477         pSMB->LastWriteTime = 0xFFFFFFFF;
478         pSMB->ByteCount = 0;
479 -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
480 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
481 +       rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
482         cifs_stats_inc(&tcon->num_closes);
483         if (rc) {
484                 if(rc!=-EINTR) {
485 @@ -1804,8 +1810,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
486                 }
487         }
489 -       cifs_small_buf_release(pSMB);
491         /* Since session is dead, file will be closed on server already */
492         if(rc == -EAGAIN)
493                 rc = 0;
494 @@ -2989,7 +2993,8 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
495         iov[0].iov_base = (char *)pSMB;
496         iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
498 -       rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 0);
499 +       rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
500 +                        CIFS_STD_OP);
501         cifs_stats_inc(&tcon->num_acl_get);
502         if (rc) {
503                 cFYI(1, ("Send error in QuerySecDesc = %d", rc));
504 @@ -3634,8 +3639,6 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, const __u16 searchHandle
506         int rc = 0;
507         FINDCLOSE_REQ *pSMB = NULL;
508 -       CLOSE_RSP *pSMBr = NULL; /* BB removeme BB */
509 -       int bytes_returned;
511         cFYI(1, ("In CIFSSMBFindClose"));
512         rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB);
513 @@ -3647,16 +3650,13 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, const __u16 searchHandle
514         if (rc)
515                 return rc;
517 -       pSMBr = (CLOSE_RSP *)pSMB;  /* BB removeme BB */
518         pSMB->FileID = searchHandle;
519         pSMB->ByteCount = 0;
520 -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
521 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
522 +       rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
523         if (rc) {
524                 cERROR(1, ("Send error in FindClose = %d", rc));
525         }
526         cifs_stats_inc(&tcon->num_fclose);
527 -       cifs_small_buf_release(pSMB);
529         /* Since session is dead, search handle closed on server already */
530         if (rc == -EAGAIN)
531 @@ -4571,11 +4571,9 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
532                     __u16 fid, __u32 pid_of_opener, int SetAllocation)
534         struct smb_com_transaction2_sfi_req *pSMB  = NULL;
535 -       struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
536         char *data_offset;
537         struct file_end_of_file_info *parm_data;
538         int rc = 0;
539 -       int bytes_returned = 0;
540         __u16 params, param_offset, offset, byte_count, count;
542         cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
543 @@ -4585,8 +4583,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
544         if (rc)
545                 return rc;
547 -       pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
549         pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
550         pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
551      
552 @@ -4637,17 +4633,13 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
553         pSMB->Reserved4 = 0;
554         pSMB->hdr.smb_buf_length += byte_count;
555         pSMB->ByteCount = cpu_to_le16(byte_count);
556 -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
557 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
558 +       rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
559         if (rc) {
560                 cFYI(1,
561                      ("Send error in SetFileInfo (SetFileSize) = %d",
562                       rc));
563         }
565 -       if (pSMB)
566 -               cifs_small_buf_release(pSMB);
568         /* Note: On -EAGAIN error only caller can retry on handle based calls 
569                 since file handle passed in no longer valid */
571 @@ -4665,10 +4657,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
572                     __u16 fid)
574         struct smb_com_transaction2_sfi_req *pSMB  = NULL;
575 -       struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
576         char *data_offset;
577         int rc = 0;
578 -       int bytes_returned = 0;
579         __u16 params, param_offset, offset, byte_count, count;
581         cFYI(1, ("Set Times (via SetFileInfo)"));
582 @@ -4677,8 +4667,6 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
583         if (rc)
584                 return rc;
586 -       pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
588         /* At this point there is no need to override the current pid
589         with the pid of the opener, but that could change if we someday
590         use an existing handle (rather than opening one on the fly) */
591 @@ -4718,14 +4706,11 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
592         pSMB->hdr.smb_buf_length += byte_count;
593         pSMB->ByteCount = cpu_to_le16(byte_count);
594         memcpy(data_offset,data,sizeof(FILE_BASIC_INFO));
595 -       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
596 -                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
597 +       rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
598         if (rc) {
599                 cFYI(1,("Send error in Set Time (SetFileInfo) = %d",rc));
600         }
602 -       cifs_small_buf_release(pSMB);
604         /* Note: On -EAGAIN error only caller can retry on handle based calls 
605                 since file handle passed in no longer valid */
607 @@ -5016,7 +5001,8 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
608         pSMB->ByteCount = 0;
610         rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
611 -                       (struct smb_hdr *) pSMBr, &bytes_returned, -1);
612 +                        (struct smb_hdr *)pSMBr, &bytes_returned,
613 +                        CIFS_ASYNC_OP);
614         if (rc) {
615                 cFYI(1, ("Error in Notify = %d", rc));
616         } else {
617 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
618 index f4e9266..8579c9e 100644
619 --- a/fs/cifs/connect.c
620 +++ b/fs/cifs/connect.c
621 @@ -2273,7 +2273,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
622         pSMB->req_no_secext.ByteCount = cpu_to_le16(count);
624         rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
625 -                        &bytes_returned, 1);
626 +                        &bytes_returned, CIFS_LONG_OP);
627         if (rc) {
628  /* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */
629         } else if ((smb_buffer_response->WordCount == 3)
630 @@ -2559,7 +2559,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
631         pSMB->req.ByteCount = cpu_to_le16(count);
633         rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
634 -                        &bytes_returned, 1);
635 +                        &bytes_returned, CIFS_LONG_OP);
637         if (smb_buffer_response->Status.CifsError ==
638             cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))
639 @@ -2985,7 +2985,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
640         pSMB->req.ByteCount = cpu_to_le16(count);
642         rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
643 -                        &bytes_returned, 1);
644 +                        &bytes_returned, CIFS_LONG_OP);
645         if (rc) {
646  /*    rc = map_smb_to_linux_error(smb_buffer_response);  *//* done in SendReceive now */
647         } else if ((smb_buffer_response->WordCount == 3)
648 @@ -3256,7 +3256,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
649         pSMB->hdr.smb_buf_length += count;
650         pSMB->ByteCount = cpu_to_le16(count);
652 -       rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0);
653 +       rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
654 +                        CIFS_STD_OP);
656         /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */
657         /* above now done in SendReceive */
658 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
659 index 94d5b49..a2c9e7a 100644
660 --- a/fs/cifs/file.c
661 +++ b/fs/cifs/file.c
662 @@ -809,9 +809,9 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
663         xid = GetXid();
665         if (*poffset > file->f_path.dentry->d_inode->i_size)
666 -               long_op = 2; /* writes past end of file can take a long time */
667 +               long_op = CIFS_VLONG_OP; /* writes past EOF take long time */
668         else
669 -               long_op = 1;
670 +               long_op = CIFS_LONG_OP;
672         for (total_written = 0; write_size > total_written;
673              total_written += bytes_written) {
674 @@ -858,7 +858,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
675                         }
676                 } else
677                         *poffset += bytes_written;
678 -               long_op = FALSE; /* subsequent writes fast -
679 +               long_op = CIFS_STD_OP; /* subsequent writes fast -
680                                     15 seconds is plenty */
681         }
683 @@ -908,9 +908,9 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
684         xid = GetXid();
686         if (*poffset > file->f_path.dentry->d_inode->i_size)
687 -               long_op = 2; /* writes past end of file can take a long time */
688 +               long_op = CIFS_VLONG_OP; /* writes past EOF can be slow */
689         else
690 -               long_op = 1;
691 +               long_op = CIFS_LONG_OP;
693         for (total_written = 0; write_size > total_written;
694              total_written += bytes_written) {
695 @@ -976,7 +976,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
696                         }
697                 } else
698                         *poffset += bytes_written;
699 -               long_op = FALSE; /* subsequent writes fast - 
700 +               long_op = CIFS_STD_OP; /* subsequent writes fast -
701                                     15 seconds is plenty */
702         }
704 @@ -1276,7 +1276,7 @@ retry:
705                                                    open_file->netfid,
706                                                    bytes_to_write, offset,
707                                                    &bytes_written, iov, n_iov,
708 -                                                  1);
709 +                                                  CIFS_LONG_OP);
710                                 atomic_dec(&open_file->wrtPending);
711                                 if (rc || bytes_written < bytes_to_write) {
712                                         cERROR(1,("Write2 ret %d, written = %d",
713 diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
714 index 7584646..9834895 100644
715 --- a/fs/cifs/sess.c
716 +++ b/fs/cifs/sess.c
717 @@ -489,7 +489,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
719         iov[1].iov_base = str_area;
720         iov[1].iov_len = count; 
721 -       rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type, 0);
722 +       rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type,
723 +                         CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR);
724         /* SMB request buf freed in SendReceive2 */
726         cFYI(1,("ssetup rc from sendrecv2 is %d",rc));
727 diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
728 index 5f46845..473962f 100644
729 --- a/fs/cifs/transport.c
730 +++ b/fs/cifs/transport.c
731 @@ -308,7 +308,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
733  static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
735 -       if(long_op == -1) {
736 +       if (long_op == CIFS_ASYNC_OP) {
737                 /* oplock breaks must not be held up */
738                 atomic_inc(&ses->server->inFlight);
739         } else {
740 @@ -337,7 +337,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
741                                    they are allowed to block on server */
742                                         
743                                 /* update # of requests on the wire to server */
744 -                               if (long_op < 3)
745 +                               if (long_op != CIFS_BLOCKING_OP)
746                                         atomic_inc(&ses->server->inFlight);
747                                 spin_unlock(&GlobalMid_Lock);
748                                 break;
749 @@ -416,17 +416,48 @@ static int wait_for_response(struct cifsSesInfo *ses,
750         }
755 + *
756 + * Send an SMB Request.  No response info (other than return code)
757 + * needs to be parsed.
758 + *
759 + * flags indicate the type of request buffer and how long to wait
760 + * and whether to log NT STATUS code (error) before mapping it to POSIX error
761 + *
762 + */
763 +int
764 +SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
765 +               struct smb_hdr *in_buf, int flags)
767 +       int rc;
768 +       struct kvec iov[1];
769 +       int resp_buf_type;
771 +       iov[0].iov_base = (char *)in_buf;
772 +       iov[0].iov_len = in_buf->smb_buf_length + 4;
773 +       flags |= CIFS_NO_RESP;
774 +       rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
775 +#ifdef CONFIG_CIFS_DEBUG2
776 +       cFYI(1, ("SendRcvNoR flags %d rc %d", flags, rc));
777 +#endif
778 +       return rc;
781  int
782  SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 
783              struct kvec *iov, int n_vec, int * pRespBufType /* ret */, 
784 -            const int long_op)
785 +            const int flags)
787         int rc = 0;
788 +       int long_op;
789         unsigned int receive_len;
790         unsigned long timeout;
791         struct mid_q_entry *midQ;
792         struct smb_hdr *in_buf = iov[0].iov_base;
793         
794 +       long_op = flags & CIFS_TIMEOUT_MASK;
796         *pRespBufType = CIFS_NO_BUFFER;  /* no response buf yet */
798         if ((ses == NULL) || (ses->server == NULL)) {
799 @@ -485,15 +516,22 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
800         if(rc < 0)
801                 goto out;
803 -       if (long_op == -1)
804 -               goto out;
805 -       else if (long_op == 2) /* writes past end of file can take loong time */
806 +       if (long_op == CIFS_STD_OP)
807 +               timeout = 15 * HZ;
808 +       else if (long_op == CIFS_VLONG_OP) /* e.g. slow writes past EOF */
809                 timeout = 180 * HZ;
810 -       else if (long_op == 1)
811 +       else if (long_op == CIFS_LONG_OP)
812                 timeout = 45 * HZ; /* should be greater than 
813                         servers oplock break timeout (about 43 seconds) */
814 -       else
815 -               timeout = 15 * HZ;
816 +       else if (long_op == CIFS_ASYNC_OP)
817 +               goto out;
818 +       else if (long_op == CIFS_BLOCKING_OP)
819 +               timeout = 0x7FFFFFFF; /*  large, but not so large as to wrap */
820 +       else {
821 +               cERROR(1, ("unknown timeout flag %d", long_op));
822 +               rc = -EIO;
823 +               goto out;
824 +       }
826         /* wait for 15 seconds or until woken up due to response arriving or 
827            due to last connection to this server being unmounted */
828 @@ -578,8 +616,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
829                             (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
830                                 BCC(midQ->resp_buf) = 
831                                         le16_to_cpu(BCC_LE(midQ->resp_buf));
832 -                       midQ->resp_buf = NULL;  /* mark it so will not be freed
833 -                                               by DeleteMidQEntry */
834 +                       if ((flags & CIFS_NO_RESP) == 0)
835 +                               midQ->resp_buf = NULL;  /* mark it so buf will
836 +                                                          not be freed by
837 +                                                          DeleteMidQEntry */
838                 } else {
839                         rc = -EIO;
840                         cFYI(1,("Bad MID state?"));
841 @@ -667,17 +707,25 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
842         if(rc < 0)
843                 goto out;
845 -       if (long_op == -1)
846 +       if (long_op == CIFS_STD_OP)
847 +               timeout = 15 * HZ;
848 +       /* wait for 15 seconds or until woken up due to response arriving or
849 +          due to last connection to this server being unmounted */
850 +       else if (long_op == CIFS_ASYNC_OP)
851                 goto out;
852 -       else if (long_op == 2) /* writes past end of file can take loong time */
853 +       else if (long_op == CIFS_VLONG_OP) /* writes past EOF can be slow */
854                 timeout = 180 * HZ;
855 -       else if (long_op == 1)
856 +       else if (long_op == CIFS_LONG_OP)
857                 timeout = 45 * HZ; /* should be greater than 
858                         servers oplock break timeout (about 43 seconds) */
859 -       else
860 -               timeout = 15 * HZ;
861 -       /* wait for 15 seconds or until woken up due to response arriving or 
862 -          due to last connection to this server being unmounted */
863 +       else if (long_op == CIFS_BLOCKING_OP)
864 +               timeout = 0x7FFFFFFF; /* large but no so large as to wrap */
865 +       else {
866 +               cERROR(1, ("unknown timeout flag %d", long_op));
867 +               rc = -EIO;
868 +               goto out;
869 +       }
871         if (signal_pending(current)) {
872                 /* if signal pending do not hold up user for full smb timeout
873                 but we still give response a chance to complete */
874 @@ -817,7 +865,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon,
875         pSMB->hdr.Mid = GetNextMid(ses->server);
877         return SendReceive(xid, ses, in_buf, out_buf,
878 -                       &bytes_returned, 0);
879 +                       &bytes_returned, CIFS_STD_OP);
882  int
883 @@ -849,7 +897,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
884            to the same server. We may make this configurable later or
885            use ses->maxReq */
887 -       rc = wait_for_free_request(ses, 3);
888 +       rc = wait_for_free_request(ses, CIFS_BLOCKING_OP);
889         if (rc)
890                 return rc;
892 diff --git a/mm/slab.c b/mm/slab.c
893 index b344e67..42bf493 100644
894 --- a/mm/slab.c
895 +++ b/mm/slab.c
896 @@ -2933,11 +2933,10 @@ static void *cache_alloc_refill(struct kmem_cache *cachep, gfp_t flags)
897         struct array_cache *ac;
898         int node;
900 -       node = numa_node_id();
902 +retry:
903         check_irq_off();
904 +       node = numa_node_id();
905         ac = cpu_cache_get(cachep);
906 -retry:
907         batchcount = ac->batchcount;
908         if (!ac->touched && batchcount > BATCHREFILL_LIMIT) {
909                 /*