From c60631879dbe6e87bc03c0412a4c8857b2f4339b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Aug 2008 09:59:54 -0700 Subject: [PATCH] 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 (cherry picked from commit 91dcce0e4deb87c6d5e491eb9dbb09fd04981d28) --- source/smbd/aio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/smbd/aio.c b/source/smbd/aio.c index 2559dc95057..21b6efb1986 100644 --- a/source/smbd/aio.c +++ b/source/smbd/aio.c @@ -253,12 +253,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", @@ -343,12 +346,15 @@ 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(); if (!write_through && !lp_syncalways(SNUM(fsp->conn)) && fsp->aio_write_behind) { -- 2.34.1