summaryrefslogtreecommitdiff
path: root/source3/smbd/aio.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-08-24 13:58:05 +1000
committerMichael Adam <obnox@samba.org>2008-08-26 14:39:43 +0200
commit563a7ccdd9d23ffbd3195c8def82cd4d8d4cb0dc (patch)
treefa07e3d3b5b1fbdad46796327548f4c1807dcacc /source3/smbd/aio.c
parentd9f61dbdc91fae6560361f98d981b1f7bea80422 (diff)
downloadsamba-563a7ccdd9d23ffbd3195c8def82cd4d8d4cb0dc.tar.gz
samba-563a7ccdd9d23ffbd3195c8def82cd4d8d4cb0dc.tar.bz2
samba-563a7ccdd9d23ffbd3195c8def82cd4d8d4cb0dc.zip
become root for AIO operations
We need to become root for AIO read and write to allow the AIO thread to send a completion signal to the parent process when the IO completes (This used to be commit c548e5c69f9d8bc85a654f4d29d64c735a5e780b)
Diffstat (limited to 'source3/smbd/aio.c')
-rw-r--r--source3/smbd/aio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 2889e3c13f..74275368bd 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -268,12 +268,15 @@ bool schedule_aio_read_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
+ become_root();
if (SMB_VFS_AIO_READ(fsp,a) == -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",
@@ -366,13 +369,16 @@ bool schedule_aio_write_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
+ become_root();
if (SMB_VFS_AIO_WRITE(fsp,a) == -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))