diff options
author | Steve French <smfrench@austin.rr.com> | 2005-04-29 01:41:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-29 01:41:10 -0400 |
commit | 57337e42f1393941d59d5154eed27a63988ff2be (patch) | |
tree | 52a66ef24ea412473702a63f261e1520cf8e1885 | |
parent | 11aa0149d0e49ee1791735ec4ae3079b27b9a68e (diff) |
[PATCH] cifs: handle termination of cifs oplockd kernel thread
Signed-off-by: Steve French (sfrench@us.ibm.com)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/cifs/CHANGES | 1 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 1 | ||||
-rw-r--r-- | fs/cifs/connect.c | 11 | ||||
-rw-r--r-- | fs/cifs/misc.c | 25 |
4 files changed, 23 insertions, 15 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 21a246473a91..bd3b55e1be17 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,6 +1,7 @@ | |||
1 | Version 1.34 | 1 | Version 1.34 |
2 | ------------ | 2 | ------------ |
3 | Fix error mapping of the TOO_MANY_LINKS (hardlinks) case. | 3 | Fix error mapping of the TOO_MANY_LINKS (hardlinks) case. |
4 | Do not oops if user kills cifs oplock kernel thread. | ||
4 | 5 | ||
5 | Version 1.33 | 6 | Version 1.33 |
6 | ------------ | 7 | ------------ |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6322aada491f..8cc23e7d0d5d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -835,6 +835,7 @@ static int cifs_oplock_thread(void * dummyarg) | |||
835 | } | 835 | } |
836 | } while(!signal_pending(current)); | 836 | } while(!signal_pending(current)); |
837 | complete_and_exit (&cifs_oplock_exited, 0); | 837 | complete_and_exit (&cifs_oplock_exited, 0); |
838 | oplockThread = NULL; | ||
838 | } | 839 | } |
839 | 840 | ||
840 | static int __init | 841 | static int __init |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e3b177a90b37..437be1efe99e 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -384,7 +384,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
384 | if(server->tcpStatus == CifsExiting) { | 384 | if(server->tcpStatus == CifsExiting) { |
385 | break; | 385 | break; |
386 | } else if (server->tcpStatus == CifsNeedReconnect) { | 386 | } else if (server->tcpStatus == CifsNeedReconnect) { |
387 | cFYI(1,("Reconnecting after server stopped responding")); | 387 | cFYI(1,("Reconnect after server stopped responding")); |
388 | cifs_reconnect(server); | 388 | cifs_reconnect(server); |
389 | cFYI(1,("call to reconnect done")); | 389 | cFYI(1,("call to reconnect done")); |
390 | csocket = server->ssocket; | 390 | csocket = server->ssocket; |
@@ -396,7 +396,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
396 | continue; | 396 | continue; |
397 | } else if (length <= 0) { | 397 | } else if (length <= 0) { |
398 | if(server->tcpStatus == CifsNew) { | 398 | if(server->tcpStatus == CifsNew) { |
399 | cFYI(1,("tcp session abended prematurely (after SMBnegprot)")); | 399 | cFYI(1,("tcp session abend after SMBnegprot")); |
400 | /* some servers kill the TCP session rather than | 400 | /* some servers kill the TCP session rather than |
401 | returning an SMB negprot error, in which | 401 | returning an SMB negprot error, in which |
402 | case reconnecting here is not going to help, | 402 | case reconnecting here is not going to help, |
@@ -407,14 +407,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
407 | cFYI(1,("cifsd thread killed")); | 407 | cFYI(1,("cifsd thread killed")); |
408 | break; | 408 | break; |
409 | } | 409 | } |
410 | cFYI(1,("Reconnecting after unexpected peek error %d",length)); | 410 | cFYI(1,("Reconnect after unexpected peek error %d", |
411 | length)); | ||
411 | cifs_reconnect(server); | 412 | cifs_reconnect(server); |
412 | csocket = server->ssocket; | 413 | csocket = server->ssocket; |
413 | wake_up(&server->response_q); | 414 | wake_up(&server->response_q); |
414 | continue; | 415 | continue; |
415 | } else if (length < 4) { | 416 | } else if (length < 4) { |
416 | cFYI(1, | 417 | cFYI(1, |
417 | ("Frame less than four bytes received %d bytes long.", | 418 | ("Frame under four bytes received (%d bytes long)", |
418 | length)); | 419 | length)); |
419 | cifs_reconnect(server); | 420 | cifs_reconnect(server); |
420 | csocket = server->ssocket; | 421 | csocket = server->ssocket; |
@@ -593,7 +594,7 @@ multi_t2_fnd: | |||
593 | smallbuf = NULL; | 594 | smallbuf = NULL; |
594 | } | 595 | } |
595 | wake_up_process(task_to_wake); | 596 | wake_up_process(task_to_wake); |
596 | } else if ((is_valid_oplock_break(smb_buffer) == FALSE) | 597 | } else if ((is_valid_oplock_break(smb_buffer) == FALSE) |
597 | && (isMultiRsp == FALSE)) { | 598 | && (isMultiRsp == FALSE)) { |
598 | cERROR(1, ("No task to wake, unknown frame rcvd!")); | 599 | cERROR(1, ("No task to wake, unknown frame rcvd!")); |
599 | cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); | 600 | cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 75fd3bd6e233..db14b503d89e 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -452,25 +452,30 @@ is_valid_oplock_break(struct smb_hdr *buf) | |||
452 | atomic_inc(&tcon->num_oplock_brks); | 452 | atomic_inc(&tcon->num_oplock_brks); |
453 | #endif | 453 | #endif |
454 | list_for_each(tmp1,&tcon->openFileList){ | 454 | list_for_each(tmp1,&tcon->openFileList){ |
455 | netfile = list_entry(tmp1,struct cifsFileInfo,tlist); | 455 | netfile = list_entry(tmp1,struct cifsFileInfo, |
456 | tlist); | ||
456 | if(pSMB->Fid == netfile->netfid) { | 457 | if(pSMB->Fid == netfile->netfid) { |
457 | struct cifsInodeInfo *pCifsInode; | 458 | struct cifsInodeInfo *pCifsInode; |
458 | read_unlock(&GlobalSMBSeslock); | 459 | read_unlock(&GlobalSMBSeslock); |
459 | cFYI(1,("Matching file id, processing oplock break")); | 460 | cFYI(1,("file id match, oplock break")); |
460 | pCifsInode = | 461 | pCifsInode = |
461 | CIFS_I(netfile->pInode); | 462 | CIFS_I(netfile->pInode); |
462 | pCifsInode->clientCanCacheAll = FALSE; | 463 | pCifsInode->clientCanCacheAll = FALSE; |
463 | if(pSMB->OplockLevel == 0) | 464 | if(pSMB->OplockLevel == 0) |
464 | pCifsInode->clientCanCacheRead = FALSE; | 465 | pCifsInode->clientCanCacheRead |
466 | = FALSE; | ||
465 | pCifsInode->oplockPending = TRUE; | 467 | pCifsInode->oplockPending = TRUE; |
466 | AllocOplockQEntry(netfile->pInode, netfile->netfid, tcon); | 468 | AllocOplockQEntry(netfile->pInode, |
469 | netfile->netfid, | ||
470 | tcon); | ||
467 | cFYI(1,("about to wake up oplock thd")); | 471 | cFYI(1,("about to wake up oplock thd")); |
468 | wake_up_process(oplockThread); | 472 | if(oplockThread) |
473 | wake_up_process(oplockThread); | ||
469 | return TRUE; | 474 | return TRUE; |
470 | } | 475 | } |
471 | } | 476 | } |
472 | read_unlock(&GlobalSMBSeslock); | 477 | read_unlock(&GlobalSMBSeslock); |
473 | cFYI(1,("No matching file for oplock break on connection")); | 478 | cFYI(1,("No matching file for oplock break")); |
474 | return TRUE; | 479 | return TRUE; |
475 | } | 480 | } |
476 | } | 481 | } |
@@ -491,7 +496,7 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) | |||
491 | 496 | ||
492 | buffer = (unsigned char *) smb_buf; | 497 | buffer = (unsigned char *) smb_buf; |
493 | for (i = 0, j = 0; i < smb_buf_length; i++, j++) { | 498 | for (i = 0, j = 0; i < smb_buf_length; i++, j++) { |
494 | if (i % 8 == 0) { /* we have reached the beginning of line */ | 499 | if (i % 8 == 0) { /* have reached the beginning of line */ |
495 | printk(KERN_DEBUG "| "); | 500 | printk(KERN_DEBUG "| "); |
496 | j = 0; | 501 | j = 0; |
497 | } | 502 | } |
@@ -502,7 +507,7 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) | |||
502 | else | 507 | else |
503 | debug_line[1 + (2 * j)] = '_'; | 508 | debug_line[1 + (2 * j)] = '_'; |
504 | 509 | ||
505 | if (i % 8 == 7) { /* we have reached end of line, time to print ascii */ | 510 | if (i % 8 == 7) { /* reached end of line, time to print ascii */ |
506 | debug_line[16] = 0; | 511 | debug_line[16] = 0; |
507 | printk(" | %s\n", debug_line); | 512 | printk(" | %s\n", debug_line); |
508 | } | 513 | } |
@@ -577,7 +582,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen, | |||
577 | } | 582 | } |
578 | } | 583 | } |
579 | j++; | 584 | j++; |
580 | /* check to make sure we do not overrun callers allocated temp buffer */ | 585 | /* make sure we do not overrun callers allocated temp buffer */ |
581 | if(j >= (2 * NAME_MAX)) | 586 | if(j >= (2 * NAME_MAX)) |
582 | break; | 587 | break; |
583 | } | 588 | } |
@@ -599,7 +604,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen, | |||
599 | char src_char; | 604 | char src_char; |
600 | 605 | ||
601 | if(!mapChars) | 606 | if(!mapChars) |
602 | return cifs_strtoUCS((wchar_t *) target, source, PATH_MAX, cp); | 607 | return cifs_strtoUCS((wchar_t *) target, source, PATH_MAX, cp); |
603 | 608 | ||
604 | for(i = 0, j = 0; i < maxlen; j++) { | 609 | for(i = 0, j = 0; i < maxlen; j++) { |
605 | src_char = source[i]; | 610 | src_char = source[i]; |