summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-11-02 21:52:16 +0100
committerVolker Lendecke <vl@samba.org>2008-11-02 21:53:44 +0100
commitf3e638bc9fad7d3a54a9b41de8857c126c656f5c (patch)
tree257cb08c793d8cdff277010e51e87fa331d97c26
parentc2a280ac630a41221cff6e72ceda8661c3b78d83 (diff)
downloadsamba-f3e638bc9fad7d3a54a9b41de8857c126c656f5c.tar.gz
samba-f3e638bc9fad7d3a54a9b41de8857c126c656f5c.tar.bz2
samba-f3e638bc9fad7d3a54a9b41de8857c126c656f5c.zip
Make a [un]become_root wrap a bit tighter
Sooner or later this would bite us.
-rw-r--r--source3/smbd/aio.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index aca7a192c3..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 */
@@ -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",
@@ -313,6 +315,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
size_t inbufsize, outbufsize;
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 */
@@ -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))