Ignore:
Timestamp:
Jan 15, 2010, 8:23:30 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.10 (source)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/smbd/aio.c

    r222 r370  
    427427*****************************************************************************/
    428428
    429 static int handle_aio_read_complete(struct aio_extra *aio_ex)
    430 {
    431         int ret = 0;
     429static int handle_aio_read_complete(struct aio_extra *aio_ex, int errcode)
     430{
    432431        int outsize;
    433432        char *outbuf = aio_ex->outbuf;
     
    441440                   true.... JRA. */
    442441
    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. "
    451443                           "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));
    456447                outsize = srv_set_message(outbuf,0,0,true);
    457448        } else {
     
    485476                  (unsigned int)nread ));
    486477
    487         return ret;
     478        return errcode;
    488479}
    489480
     
    493484*****************************************************************************/
    494485
    495 static int handle_aio_write_complete(struct aio_extra *aio_ex)
    496 {
    497         int ret = 0;
     486static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode)
     487{
    498488        files_struct *fsp = aio_ex->fsp;
    499489        char *outbuf = aio_ex->outbuf;
     
    507497                                         "aio_write_behind failed ! File %s "
    508498                                         "is corrupt ! Error %s\n",
    509                                          fsp->fsp_name, strerror(errno) ));
    510                                 ret = errno;
     499                                         fsp->fsp_name, strerror(errcode) ));
    511500                        } else {
    512501                                DEBUG(0,("handle_aio_write_complete: "
     
    516505                                         (unsigned int)numtowrite,
    517506                                         (int)nwritten ));
    518                                 ret = EIO;
     507                                errcode = EIO;
    519508                        }
    520509                } else {
     
    523512                                  fsp->fsp_name ));
    524513                }
     514                /* TODO: should no return 0 in case of an error !!! */
    525515                return 0;
    526516        }
     
    535525                           (int)nwritten, strerror(errno) ));
    536526
    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));
    546528                srv_set_message(outbuf,0,0,true);
    547529        } else {
     
    560542                status = sync_file(fsp->conn,fsp, write_through);
    561543                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),
    564546                                   ERRHRD, ERRdiskfull);
    565547                        srv_set_message(outbuf,0,0,true);
     
    581563                  (unsigned int)numtowrite, (unsigned int)nwritten ));
    582564
    583         return ret;
     565        return errcode;
    584566}
    585567
     
    599581
    600582        /* 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) {
    602585                DEBUG(10,( "handle_aio_completed: operation mid %u still in "
    603586                           "process for file %s\n",
    604587                           aio_ex->mid, aio_ex->fsp->fsp_name ));
    605588                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
    607598
    608599        if (aio_ex->read_req) {
    609                 err = handle_aio_read_complete(aio_ex);
     600                err = handle_aio_read_complete(aio_ex, err);
    610601        } else {
    611                 err = handle_aio_write_complete(aio_ex);
     602                err = handle_aio_write_complete(aio_ex, err);
    612603        }
    613604
Note: See TracChangeset for help on using the changeset viewer.