summaryrefslogtreecommitdiff
path: root/source3/smbd/aio.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-03 00:15:27 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-03 00:15:27 +0100
commitc5a70cab25de3b0acd89ba12150b9077bb59cbb5 (patch)
treeda8887ad758b62641006185c64b7d46c6c650f68 /source3/smbd/aio.c
parent1575cae7e53a5738d7e2530e855aef68ca971706 (diff)
parent7808a2594c22ff452d54d2e9e272aa60e4b7e482 (diff)
downloadsamba-c5a70cab25de3b0acd89ba12150b9077bb59cbb5.tar.gz
samba-c5a70cab25de3b0acd89ba12150b9077bb59cbb5.tar.bz2
samba-c5a70cab25de3b0acd89ba12150b9077bb59cbb5.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/smbd/aio.c')
-rw-r--r--source3/smbd/aio.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index c3fd0a2bc0..4ed574cec7 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -221,6 +221,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
SMB_STRUCT_AIOCB *a;
size_t bufsize;
size_t min_aio_read_size = lp_aio_read_size(SNUM(conn));
+ int ret;
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
@@ -240,7 +241,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
/* Only do this on non-chained and non-chaining reads not using the
* write cache. */
- if (chain_size !=0 || (CVAL(req->inbuf,smb_vwv0) != 0xFF)
+ if (chain_size !=0 || (CVAL(req->vwv+0, 0) != 0xFF)
|| (lp_write_cache_size(SNUM(conn)) != 0) ) {
return False;
}
@@ -279,14 +280,15 @@ bool schedule_aio_read_and_X(connection_struct *conn,
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
become_root();
- if (SMB_VFS_AIO_READ(fsp,a) == -1) {
+ ret = SMB_VFS_AIO_READ(fsp, a);
+ unbecome_root();
+
+ if (ret == -1) {
DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
"Error %s\n", strerror(errno) ));
delete_aio_ex(aio_ex);
- unbecome_root();
return False;
}
- unbecome_root();
DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
"offset %.0f, len = %u (mid = %u)\n",
@@ -311,8 +313,9 @@ bool schedule_aio_write_and_X(connection_struct *conn,
struct aio_extra *aio_ex;
SMB_STRUCT_AIOCB *a;
size_t inbufsize, outbufsize;
- bool write_through = BITSETW(req->inbuf+smb_vwv7,0);
+ bool write_through = BITSETW(req->vwv+7,0);
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
+ int ret;
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
@@ -332,7 +335,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
/* Only do this on non-chained and non-chaining reads not using the
* write cache. */
- if (chain_size !=0 || (CVAL(req->inbuf,smb_vwv0) != 0xFF)
+ if (chain_size !=0 || (CVAL(req->vwv+0, 0) != 0xFF)
|| (lp_write_cache_size(SNUM(conn)) != 0) ) {
return False;
}
@@ -380,15 +383,16 @@ bool schedule_aio_write_and_X(connection_struct *conn,
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
become_root();
- if (SMB_VFS_AIO_WRITE(fsp,a) == -1) {
+ ret = SMB_VFS_AIO_WRITE(fsp, a);
+ unbecome_root();
+
+ if (ret == -1) {
DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
"Error %s\n", strerror(errno) ));
delete_aio_ex(aio_ex);
- unbecome_root();
return False;
}
- unbecome_root();
-
+
release_level_2_oplocks_on_change(fsp);
if (!write_through && !lp_syncalways(SNUM(fsp->conn))