summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-18 13:30:16 +0200
committerVolker Lendecke <vl@samba.org>2009-05-18 13:38:56 +0200
commit5fb3b8e377deeb0ce362a7bcb9323542b579fdef (patch)
tree2b754e4daa9bae472efacc0118b19f7550398eba /source3/modules
parentbbbf9f13add12906480e6697eb56a2680dabe160 (diff)
downloadsamba-5fb3b8e377deeb0ce362a7bcb9323542b579fdef.tar.gz
samba-5fb3b8e377deeb0ce362a7bcb9323542b579fdef.tar.bz2
samba-5fb3b8e377deeb0ce362a7bcb9323542b579fdef.zip
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.
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_default.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6c1946a99d..aa207056b3 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)