Changeset 370 for branches/samba-3.3.x/source/smbd/aio.c
- Timestamp:
- Jan 15, 2010, 8:23:30 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/smbd/aio.c
r222 r370 427 427 *****************************************************************************/ 428 428 429 static int handle_aio_read_complete(struct aio_extra *aio_ex) 430 { 431 int ret = 0; 429 static int handle_aio_read_complete(struct aio_extra *aio_ex, int errcode) 430 { 432 431 int outsize; 433 432 char *outbuf = aio_ex->outbuf; … … 441 440 true.... JRA. */ 442 441 443 /* If errno is ECANCELED then don't return anything to the 444 * client. */ 445 if (errno == ECANCELED) { 446 srv_cancel_sign_response(aio_ex->mid, false); 447 return 0; 448 } 449 450 DEBUG( 3,( "handle_aio_read_complete: file %s nread == -1. " 442 DEBUG( 3,( "handle_aio_read_complete: file %s nread == %d. " 451 443 "Error = %s\n", 452 aio_ex->fsp->fsp_name, strerror(errno) )); 453 454 ret = errno; 455 ERROR_NT(map_nt_error_from_unix(ret)); 444 aio_ex->fsp->fsp_name, (int)nread, strerror(errcode) )); 445 446 ERROR_NT(map_nt_error_from_unix(errcode)); 456 447 outsize = srv_set_message(outbuf,0,0,true); 457 448 } else { … … 485 476 (unsigned int)nread )); 486 477 487 return ret;478 return errcode; 488 479 } 489 480 … … 493 484 *****************************************************************************/ 494 485 495 static int handle_aio_write_complete(struct aio_extra *aio_ex) 496 { 497 int ret = 0; 486 static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode) 487 { 498 488 files_struct *fsp = aio_ex->fsp; 499 489 char *outbuf = aio_ex->outbuf; … … 507 497 "aio_write_behind failed ! File %s " 508 498 "is corrupt ! Error %s\n", 509 fsp->fsp_name, strerror(errno) )); 510 ret = errno; 499 fsp->fsp_name, strerror(errcode) )); 511 500 } else { 512 501 DEBUG(0,("handle_aio_write_complete: " … … 516 505 (unsigned int)numtowrite, 517 506 (int)nwritten )); 518 ret= EIO;507 errcode = EIO; 519 508 } 520 509 } else { … … 523 512 fsp->fsp_name )); 524 513 } 514 /* TODO: should no return 0 in case of an error !!! */ 525 515 return 0; 526 516 } … … 535 525 (int)nwritten, strerror(errno) )); 536 526 537 /* If errno is ECANCELED then don't return anything to the 538 * client. */ 539 if (errno == ECANCELED) { 540 srv_cancel_sign_response(aio_ex->mid, false); 541 return 0; 542 } 543 544 ret = errno; 545 ERROR_BOTH(map_nt_error_from_unix(ret), ERRHRD, ERRdiskfull); 527 ERROR_NT(map_nt_error_from_unix(errcode)); 546 528 srv_set_message(outbuf,0,0,true); 547 529 } else { … … 560 542 status = sync_file(fsp->conn,fsp, write_through); 561 543 if (!NT_STATUS_IS_OK(status)) { 562 ret= errno;563 ERROR_BOTH(map_nt_error_from_unix( ret),544 errcode = errno; 545 ERROR_BOTH(map_nt_error_from_unix(errcode), 564 546 ERRHRD, ERRdiskfull); 565 547 srv_set_message(outbuf,0,0,true); … … 581 563 (unsigned int)numtowrite, (unsigned int)nwritten )); 582 564 583 return ret;565 return errcode; 584 566 } 585 567 … … 599 581 600 582 /* Ensure the operation has really completed. */ 601 if (SMB_VFS_AIO_ERROR(aio_ex->fsp, &aio_ex->acb) == EINPROGRESS) { 583 err = SMB_VFS_AIO_ERROR(aio_ex->fsp, &aio_ex->acb); 584 if (err == EINPROGRESS) { 602 585 DEBUG(10,( "handle_aio_completed: operation mid %u still in " 603 586 "process for file %s\n", 604 587 aio_ex->mid, aio_ex->fsp->fsp_name )); 605 588 return False; 606 } 589 } else if (err == ECANCELED) { 590 /* If error is ECANCELED then don't return anything to the 591 * client. */ 592 DEBUG(10,( "handle_aio_completed: operation mid %u" 593 " canceled\n", aio_ex->mid)); 594 srv_cancel_sign_response(aio_ex->mid, false); 595 return True; 596 } 597 607 598 608 599 if (aio_ex->read_req) { 609 err = handle_aio_read_complete(aio_ex );600 err = handle_aio_read_complete(aio_ex, err); 610 601 } else { 611 err = handle_aio_write_complete(aio_ex );602 err = handle_aio_write_complete(aio_ex, err); 612 603 } 613 604
Note:
See TracChangeset
for help on using the changeset viewer.