[SCM] Samba Shared Repository - branch v3-4-test updated -
release-4-0-0alpha7-1009-gb8d12d3
Volker Lendecke
vlendec at samba.org
Mon May 18 11:40:57 GMT 2009
The branch, v3-4-test has been updated
via b8d12d3ffce304b4086488d999f85d80667e196e (commit)
from f22343874833397afb2010a43ee0057fa5d8471e (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test
- Log -----------------------------------------------------------------
commit b8d12d3ffce304b4086488d999f85d80667e196e
Author: Volker Lendecke <vl at samba.org>
Date: Mon May 18 13:30:16 2009 +0200
Move down the become_root()/unbecome_root() calls into the VFS modules
The aio_fork module does not need this, as it does not communicate via signals
but with pipes. Watching a strace log with those become_root() calls in aio.c
is absolutely awful, and it does affect performance.
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_default.c | 24 ++++++++++++++++++++++--
source3/smbd/aio.c | 6 ------
2 files changed, 22 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6c1946a..aa20705 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1423,12 +1423,32 @@ static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_stru
static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
- return sys_aio_read(aiocb);
+ int ret;
+ /*
+ * aio_read must be done as root, because in the glibc aio
+ * implementation the helper thread needs to be able to send a signal
+ * to the main thread, even when it has done a seteuid() to a
+ * different user.
+ */
+ become_root();
+ ret = sys_aio_read(aiocb);
+ unbecome_root();
+ return ret;
}
static int vfswrap_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
- return sys_aio_write(aiocb);
+ int ret;
+ /*
+ * aio_write must be done as root, because in the glibc aio
+ * implementation the helper thread needs to be able to send a signal
+ * to the main thread, even when it has done a seteuid() to a
+ * different user.
+ */
+ become_root();
+ ret = sys_aio_write(aiocb);
+ unbecome_root();
+ return ret;
}
static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index cfa4b43..fbfec46 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -179,10 +179,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = req->mid;
- become_root();
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) ));
@@ -278,10 +275,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
a->aio_sigevent.sigev_value.sival_int = req->mid;
- become_root();
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) ));
--
Samba Shared Repository
More information about the samba-cvs
mailing list