mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3/vfs: wrap async io function args inside struct vfs_aio_state
Subsequent commits that are going to track aio request duration in the aio backends will use this. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
6af7ebf336
commit
3884a66e17
@ -243,9 +243,10 @@ static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t skel_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
*err = ENOSYS;
|
||||
vfs_aio_state->error = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -273,9 +274,10 @@ static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t skel_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
*err = ENOSYS;
|
||||
vfs_aio_state->error = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -323,9 +325,10 @@ static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int skel_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int skel_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
*err = ENOSYS;
|
||||
vfs_aio_state->error = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
struct skel_pread_state {
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void skel_pread_done(struct tevent_req *subreq);
|
||||
@ -277,20 +277,21 @@ static void skel_pread_done(struct tevent_req *subreq)
|
||||
struct skel_pread_state *state =
|
||||
tevent_req_data(req, struct skel_pread_state);
|
||||
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t skel_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct skel_pread_state *state =
|
||||
tevent_req_data(req, struct skel_pread_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -308,7 +309,7 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
struct skel_pwrite_state {
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void skel_pwrite_done(struct tevent_req *subreq);
|
||||
@ -343,20 +344,21 @@ static void skel_pwrite_done(struct tevent_req *subreq)
|
||||
struct skel_pwrite_state *state =
|
||||
tevent_req_data(req, struct skel_pwrite_state);
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t skel_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct skel_pwrite_state *state =
|
||||
tevent_req_data(req, struct skel_pwrite_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -393,7 +395,7 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
|
||||
|
||||
struct skel_fsync_state {
|
||||
int ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void skel_fsync_done(struct tevent_req *subreq);
|
||||
@ -425,20 +427,21 @@ static void skel_fsync_done(struct tevent_req *subreq)
|
||||
struct skel_fsync_state *state =
|
||||
tevent_req_data(req, struct skel_fsync_state);
|
||||
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static int skel_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int skel_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct skel_fsync_state *state =
|
||||
tevent_req_data(req, struct skel_fsync_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,7 @@
|
||||
const struct smb_filename * */
|
||||
/* Version 35 - Change opendir from const char *, to
|
||||
const struct smb_filename * */
|
||||
/* Version 35 - Wrap aio async funtions args in a struct vfs_aio_state */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 35
|
||||
|
||||
@ -520,6 +521,10 @@ enum vfs_fallocate_flags {
|
||||
VFS_FALLOCATE_FL_PUNCH_HOLE = 0x0002,
|
||||
};
|
||||
|
||||
struct vfs_aio_state {
|
||||
int error;
|
||||
};
|
||||
|
||||
/*
|
||||
Available VFS operations. These values must be in sync with vfs_ops struct
|
||||
(struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
|
||||
@ -604,7 +609,7 @@ struct vfs_fn_pointers {
|
||||
struct files_struct *fsp,
|
||||
void *data,
|
||||
size_t n, off_t offset);
|
||||
ssize_t (*pread_recv_fn)(struct tevent_req *req, int *err);
|
||||
ssize_t (*pread_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
ssize_t (*write_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
|
||||
ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset);
|
||||
struct tevent_req *(*pwrite_send_fn)(struct vfs_handle_struct *handle,
|
||||
@ -613,7 +618,7 @@ struct vfs_fn_pointers {
|
||||
struct files_struct *fsp,
|
||||
const void *data,
|
||||
size_t n, off_t offset);
|
||||
ssize_t (*pwrite_recv_fn)(struct tevent_req *req, int *err);
|
||||
ssize_t (*pwrite_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence);
|
||||
ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count);
|
||||
ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count);
|
||||
@ -625,7 +630,7 @@ struct vfs_fn_pointers {
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct files_struct *fsp);
|
||||
int (*fsync_recv_fn)(struct tevent_req *req, int *err);
|
||||
int (*fsync_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
int (*stat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
|
||||
int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
|
||||
int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
|
||||
@ -1028,7 +1033,7 @@ struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp,
|
||||
void *data,
|
||||
size_t n, off_t offset);
|
||||
ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, int *perrno);
|
||||
ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
|
||||
ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp, const void *data,
|
||||
@ -1042,7 +1047,7 @@ struct tevent_req *smb_vfs_call_pwrite_send(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp,
|
||||
const void *data,
|
||||
size_t n, off_t offset);
|
||||
ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, int *perrno);
|
||||
ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
|
||||
off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp, off_t offset,
|
||||
@ -1063,7 +1068,7 @@ struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct files_struct *fsp);
|
||||
int SMB_VFS_FSYNC_RECV(struct tevent_req *req, int *perrno);
|
||||
int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *state);
|
||||
|
||||
int smb_vfs_call_stat(struct vfs_handle_struct *handle,
|
||||
struct smb_filename *smb_fname);
|
||||
|
@ -534,7 +534,7 @@ static int get_idle_child(struct vfs_handle_struct *handle,
|
||||
struct aio_fork_pread_state {
|
||||
struct aio_child *child;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void aio_fork_pread_done(struct tevent_req *subreq);
|
||||
@ -632,28 +632,27 @@ static void aio_fork_pread_done(struct tevent_req *subreq)
|
||||
|
||||
retbuf = (struct rw_ret *)buf;
|
||||
state->ret = retbuf->size;
|
||||
state->err = retbuf->ret_errno;
|
||||
state->vfs_aio_state.error = retbuf->ret_errno;
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t aio_fork_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t aio_fork_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct aio_fork_pread_state *state = tevent_req_data(
|
||||
req, struct aio_fork_pread_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret == -1) {
|
||||
*err = state->err;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
struct aio_fork_pwrite_state {
|
||||
struct aio_child *child;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void aio_fork_pwrite_done(struct tevent_req *subreq);
|
||||
@ -748,28 +747,27 @@ static void aio_fork_pwrite_done(struct tevent_req *subreq)
|
||||
|
||||
retbuf = (struct rw_ret *)buf;
|
||||
state->ret = retbuf->size;
|
||||
state->err = retbuf->ret_errno;
|
||||
state->vfs_aio_state.error = retbuf->ret_errno;
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t aio_fork_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t aio_fork_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct aio_fork_pwrite_state *state = tevent_req_data(
|
||||
req, struct aio_fork_pwrite_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret == -1) {
|
||||
*err = state->err;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
struct aio_fork_fsync_state {
|
||||
struct aio_child *child;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void aio_fork_fsync_done(struct tevent_req *subreq);
|
||||
@ -856,21 +854,20 @@ static void aio_fork_fsync_done(struct tevent_req *subreq)
|
||||
|
||||
retbuf = (struct rw_ret *)buf;
|
||||
state->ret = retbuf->size;
|
||||
state->err = retbuf->ret_errno;
|
||||
state->vfs_aio_state.error = retbuf->ret_errno;
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static int aio_fork_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int aio_fork_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct aio_fork_fsync_state *state = tevent_req_data(
|
||||
req, struct aio_fork_fsync_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret == -1) {
|
||||
*err = state->err;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ static bool init_aio_linux(struct vfs_handle_struct *handle)
|
||||
struct aio_linux_state {
|
||||
struct iocb event_iocb;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static struct tevent_req *aio_linux_pread_send(
|
||||
@ -289,36 +289,35 @@ static void aio_linux_done(struct tevent_context *event_ctx,
|
||||
|
||||
if (finished.res < 0) {
|
||||
state->ret = -1;
|
||||
state->err = -finished.res;
|
||||
state->vfs_aio_state.error = -finished.res;
|
||||
} else {
|
||||
state->ret = finished.res;
|
||||
state->err = 0;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
num_events -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t aio_linux_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t aio_linux_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct aio_linux_state *state = tevent_req_data(
|
||||
req, struct aio_linux_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret == -1) {
|
||||
*err = state->err;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
static int aio_linux_int_recv(struct tevent_req *req, int *err)
|
||||
static int aio_linux_int_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
/*
|
||||
* Use implicit conversion ssize_t->int
|
||||
*/
|
||||
return aio_linux_recv(req, err);
|
||||
return aio_linux_recv(req, vfs_aio_state);
|
||||
}
|
||||
|
||||
static struct vfs_fn_pointers vfs_aio_linux_fns = {
|
||||
|
@ -289,7 +289,7 @@ struct commit_pwrite_state {
|
||||
struct vfs_handle_struct *handle;
|
||||
struct files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void commit_pwrite_written(struct tevent_req *subreq);
|
||||
@ -328,7 +328,7 @@ static void commit_pwrite_written(struct tevent_req *subreq)
|
||||
req, struct commit_pwrite_state);
|
||||
int commit_ret;
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
|
||||
if (state->ret <= 0) {
|
||||
@ -350,15 +350,16 @@ static void commit_pwrite_written(struct tevent_req *subreq)
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t commit_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t commit_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct commit_pwrite_state *state =
|
||||
tevent_req_data(req, struct commit_pwrite_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ struct vfswrap_asys_state {
|
||||
struct asys_context *asys_ctx;
|
||||
struct tevent_req *req;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
|
||||
SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
|
||||
};
|
||||
@ -892,33 +892,35 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
|
||||
SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
|
||||
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
|
||||
state->ret = result->ret;
|
||||
state->err = result->err;
|
||||
state->vfs_aio_state.error = result->err;
|
||||
tevent_req_defer_callback(req, ev);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t vfswrap_asys_ssize_t_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t vfswrap_asys_ssize_t_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct vfswrap_asys_state *state = tevent_req_data(
|
||||
req, struct vfswrap_asys_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
static int vfswrap_asys_int_recv(struct tevent_req *req, int *err)
|
||||
static int vfswrap_asys_int_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct vfswrap_asys_state *state = tevent_req_data(
|
||||
req, struct vfswrap_asys_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ struct smb_full_audit_pread_state {
|
||||
vfs_handle_struct *handle;
|
||||
files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_full_audit_pread_done(struct tevent_req *subreq);
|
||||
@ -1066,17 +1066,18 @@ static void smb_full_audit_pread_done(struct tevent_req *subreq)
|
||||
struct smb_full_audit_pread_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_pread_state);
|
||||
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t smb_full_audit_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_full_audit_pread_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_pread_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
return -1;
|
||||
@ -1085,7 +1086,7 @@ static ssize_t smb_full_audit_pread_recv(struct tevent_req *req, int *err)
|
||||
do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -1120,7 +1121,7 @@ struct smb_full_audit_pwrite_state {
|
||||
vfs_handle_struct *handle;
|
||||
files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
|
||||
@ -1164,17 +1165,18 @@ static void smb_full_audit_pwrite_done(struct tevent_req *subreq)
|
||||
struct smb_full_audit_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_pwrite_state);
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_full_audit_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_pwrite_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
return -1;
|
||||
@ -1183,7 +1185,7 @@ static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req, int *err)
|
||||
do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -1261,7 +1263,7 @@ struct smb_full_audit_fsync_state {
|
||||
vfs_handle_struct *handle;
|
||||
files_struct *fsp;
|
||||
int ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_full_audit_fsync_done(struct tevent_req *subreq);
|
||||
@ -1302,17 +1304,18 @@ static void smb_full_audit_fsync_done(struct tevent_req *subreq)
|
||||
struct smb_full_audit_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_fsync_state);
|
||||
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static int smb_full_audit_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int smb_full_audit_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_full_audit_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_full_audit_fsync_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
return -1;
|
||||
@ -1321,7 +1324,7 @@ static int smb_full_audit_fsync_recv(struct tevent_req *req, int *err)
|
||||
do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
|
||||
fsp_str_do_log(state->fsp));
|
||||
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -498,9 +498,9 @@ struct glusterfs_aio_wrapper {
|
||||
|
||||
struct glusterfs_aio_state {
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct tevent_req *req;
|
||||
bool cancelled;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static int aio_wrapper_destructor(struct glusterfs_aio_wrapper *wrap)
|
||||
@ -524,10 +524,9 @@ static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, void *data)
|
||||
|
||||
if (ret < 0) {
|
||||
state->ret = -1;
|
||||
state->err = errno;
|
||||
state->vfs_aio_state.error = errno;
|
||||
} else {
|
||||
state->ret = ret;
|
||||
state->err = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -648,7 +647,7 @@ static struct glusterfs_aio_state *aio_state_create(TALLOC_CTX *mem_ctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
state = talloc(NULL, struct glusterfs_aio_state);
|
||||
state = talloc_zero(NULL, struct glusterfs_aio_state);
|
||||
|
||||
if (state == NULL) {
|
||||
TALLOC_FREE(req);
|
||||
@ -657,8 +656,6 @@ static struct glusterfs_aio_state *aio_state_create(TALLOC_CTX *mem_ctx)
|
||||
|
||||
talloc_set_destructor(wrapper, aio_wrapper_destructor);
|
||||
state->cancelled = false;
|
||||
state->ret = 0;
|
||||
state->err = 0;
|
||||
state->req = req;
|
||||
|
||||
wrapper->state = state;
|
||||
@ -736,7 +733,8 @@ static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
|
||||
return req;
|
||||
}
|
||||
|
||||
static ssize_t vfs_gluster_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t vfs_gluster_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct glusterfs_aio_state *state = NULL;
|
||||
struct glusterfs_aio_wrapper *wrapper = NULL;
|
||||
@ -754,13 +752,11 @@ static ssize_t vfs_gluster_recv(struct tevent_req *req, int *err)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret == -1) {
|
||||
*err = state->err;
|
||||
}
|
||||
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
ret = state->ret;
|
||||
|
||||
/* Clean up the state, it is in a NULL context. */
|
||||
@ -850,12 +846,13 @@ static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
|
||||
return req;
|
||||
}
|
||||
|
||||
static int vfs_gluster_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int vfs_gluster_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
/*
|
||||
* Use implicit conversion ssize_t->int
|
||||
*/
|
||||
return vfs_gluster_recv(req, err);
|
||||
return vfs_gluster_recv(req, vfs_aio_state);
|
||||
}
|
||||
|
||||
static int vfs_gluster_stat(struct vfs_handle_struct *handle,
|
||||
|
@ -2317,8 +2317,8 @@ static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
|
||||
struct vfs_gpfs_pread_state {
|
||||
struct files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
bool was_offline;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void vfs_gpfs_pread_done(struct tevent_req *subreq);
|
||||
@ -2355,21 +2355,22 @@ static void vfs_gpfs_pread_done(struct tevent_req *subreq)
|
||||
struct vfs_gpfs_pread_state *state = tevent_req_data(
|
||||
req, struct vfs_gpfs_pread_state);
|
||||
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t vfs_gpfs_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t vfs_gpfs_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct vfs_gpfs_pread_state *state = tevent_req_data(
|
||||
req, struct vfs_gpfs_pread_state);
|
||||
struct files_struct *fsp = state->fsp;
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
|
||||
if ((state->ret != -1) && state->was_offline) {
|
||||
DEBUG(10, ("sending notify\n"));
|
||||
@ -2403,8 +2404,8 @@ static ssize_t vfs_gpfs_pwrite(vfs_handle_struct *handle, files_struct *fsp,
|
||||
struct vfs_gpfs_pwrite_state {
|
||||
struct files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
bool was_offline;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void vfs_gpfs_pwrite_done(struct tevent_req *subreq);
|
||||
@ -2442,21 +2443,22 @@ static void vfs_gpfs_pwrite_done(struct tevent_req *subreq)
|
||||
struct vfs_gpfs_pwrite_state *state = tevent_req_data(
|
||||
req, struct vfs_gpfs_pwrite_state);
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct vfs_gpfs_pwrite_state *state = tevent_req_data(
|
||||
req, struct vfs_gpfs_pwrite_state);
|
||||
struct files_struct *fsp = state->fsp;
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
|
||||
if ((state->ret != -1) && state->was_offline) {
|
||||
DEBUG(10, ("sending notify\n"));
|
||||
|
@ -678,7 +678,7 @@ struct smb_time_audit_pread_state {
|
||||
struct files_struct *fsp;
|
||||
struct timespec ts1;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_time_audit_pread_done(struct tevent_req *subreq);
|
||||
@ -715,12 +715,13 @@ static void smb_time_audit_pread_done(struct tevent_req *subreq)
|
||||
struct smb_time_audit_pread_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_pread_state);
|
||||
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t smb_time_audit_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t smb_time_audit_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_time_audit_pread_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_pread_state);
|
||||
@ -734,10 +735,10 @@ static ssize_t smb_time_audit_pread_recv(struct tevent_req *req, int *err)
|
||||
smb_time_audit_log_fsp("pread", timediff, state->fsp);
|
||||
}
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -786,7 +787,7 @@ struct smb_time_audit_pwrite_state {
|
||||
struct files_struct *fsp;
|
||||
struct timespec ts1;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_time_audit_pwrite_done(struct tevent_req *subreq);
|
||||
@ -823,12 +824,13 @@ static void smb_time_audit_pwrite_done(struct tevent_req *subreq)
|
||||
struct smb_time_audit_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_pwrite_state);
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t smb_time_audit_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t smb_time_audit_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_time_audit_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_pwrite_state);
|
||||
@ -842,10 +844,10 @@ static ssize_t smb_time_audit_pwrite_recv(struct tevent_req *req, int *err)
|
||||
smb_time_audit_log_fsp("pwrite", timediff, state->fsp);
|
||||
}
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
@ -953,7 +955,7 @@ struct smb_time_audit_fsync_state {
|
||||
struct files_struct *fsp;
|
||||
struct timespec ts1;
|
||||
int ret;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_time_audit_fsync_done(struct tevent_req *subreq);
|
||||
@ -988,12 +990,13 @@ static void smb_time_audit_fsync_done(struct tevent_req *subreq)
|
||||
struct smb_time_audit_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_fsync_state);
|
||||
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static int smb_time_audit_fsync_recv(struct tevent_req *req, int *err)
|
||||
static int smb_time_audit_fsync_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_time_audit_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_time_audit_fsync_state);
|
||||
@ -1007,10 +1010,10 @@ static int smb_time_audit_fsync_recv(struct tevent_req *req, int *err)
|
||||
smb_time_audit_log_fsp("fsync", timediff, state->fsp);
|
||||
}
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -289,8 +289,8 @@ static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struc
|
||||
struct tsmsm_pread_state {
|
||||
struct files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
bool was_offline;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void tsmsm_pread_done(struct tevent_req *subreq);
|
||||
@ -326,17 +326,18 @@ static void tsmsm_pread_done(struct tevent_req *subreq)
|
||||
struct tsmsm_pread_state *state = tevent_req_data(
|
||||
req, struct tsmsm_pread_state);
|
||||
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t tsmsm_pread_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t tsmsm_pread_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct tsmsm_pread_state *state = tevent_req_data(
|
||||
req, struct tsmsm_pread_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret >= 0 && state->was_offline) {
|
||||
@ -345,15 +346,15 @@ static ssize_t tsmsm_pread_recv(struct tevent_req *req, int *err)
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name->base_name);
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
struct tsmsm_pwrite_state {
|
||||
struct files_struct *fsp;
|
||||
ssize_t ret;
|
||||
int err;
|
||||
bool was_offline;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void tsmsm_pwrite_done(struct tevent_req *subreq);
|
||||
@ -390,17 +391,18 @@ static void tsmsm_pwrite_done(struct tevent_req *subreq)
|
||||
struct tsmsm_pwrite_state *state = tevent_req_data(
|
||||
req, struct tsmsm_pwrite_state);
|
||||
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
|
||||
state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
static ssize_t tsmsm_pwrite_recv(struct tevent_req *req, int *err)
|
||||
static ssize_t tsmsm_pwrite_recv(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct tsmsm_pwrite_state *state = tevent_req_data(
|
||||
req, struct tsmsm_pwrite_state);
|
||||
|
||||
if (tevent_req_is_unix_error(req, err)) {
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
if (state->ret >= 0 && state->was_offline) {
|
||||
@ -409,7 +411,7 @@ static ssize_t tsmsm_pwrite_recv(struct tevent_req *req, int *err)
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name->base_name);
|
||||
}
|
||||
*err = state->err;
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->ret;
|
||||
}
|
||||
|
||||
|
@ -274,13 +274,13 @@ static void aio_pread_smb1_done(struct tevent_req *req)
|
||||
char *outbuf = (char *)aio_ex->outbuf.data;
|
||||
char *data = smb_buf(outbuf) + 1 /* padding byte */;
|
||||
ssize_t nread;
|
||||
int err;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
|
||||
nread = SMB_VFS_PREAD_RECV(req, &err);
|
||||
nread = SMB_VFS_PREAD_RECV(req, &vfs_aio_state);
|
||||
TALLOC_FREE(req);
|
||||
|
||||
DEBUG(10, ("pread_recv returned %d, err = %s\n", (int)nread,
|
||||
(nread == -1) ? strerror(err) : "no error"));
|
||||
(nread == -1) ? strerror(vfs_aio_state.error) : "no error"));
|
||||
|
||||
if (fsp == NULL) {
|
||||
DEBUG( 3, ("aio_pread_smb1_done: file closed whilst "
|
||||
@ -296,9 +296,9 @@ static void aio_pread_smb1_done(struct tevent_req *req)
|
||||
if (nread < 0) {
|
||||
DEBUG( 3, ("handle_aio_read_complete: file %s nread == %d. "
|
||||
"Error = %s\n", fsp_str_dbg(fsp), (int)nread,
|
||||
strerror(err)));
|
||||
strerror(vfs_aio_state.error)));
|
||||
|
||||
ERROR_NT(map_nt_error_from_unix(err));
|
||||
ERROR_NT(map_nt_error_from_unix(vfs_aio_state.error));
|
||||
outsize = srv_set_message(outbuf,0,0,true);
|
||||
} else {
|
||||
outsize = srv_set_message(outbuf, 12,
|
||||
@ -377,13 +377,13 @@ static void pwrite_fsync_write_done(struct tevent_req *subreq)
|
||||
struct pwrite_fsync_state *state = tevent_req_data(
|
||||
req, struct pwrite_fsync_state);
|
||||
connection_struct *conn = state->fsp->conn;
|
||||
int err;
|
||||
bool do_sync;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
|
||||
state->nwritten = SMB_VFS_PWRITE_RECV(subreq, &err);
|
||||
state->nwritten = SMB_VFS_PWRITE_RECV(subreq, &vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (state->nwritten == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,12 +405,13 @@ static void pwrite_fsync_sync_done(struct tevent_req *subreq)
|
||||
{
|
||||
struct tevent_req *req = tevent_req_callback_data(
|
||||
subreq, struct tevent_req);
|
||||
int ret, err;
|
||||
int ret;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
|
||||
ret = SMB_VFS_FSYNC_RECV(subreq, &err);
|
||||
ret = SMB_VFS_FSYNC_RECV(subreq, &vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (ret == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
@ -775,13 +776,13 @@ static void aio_pread_smb2_done(struct tevent_req *req)
|
||||
files_struct *fsp = aio_ex->fsp;
|
||||
NTSTATUS status;
|
||||
ssize_t nread;
|
||||
int err = 0;
|
||||
struct vfs_aio_state vfs_aio_state = { 0 };
|
||||
|
||||
nread = SMB_VFS_PREAD_RECV(req, &err);
|
||||
nread = SMB_VFS_PREAD_RECV(req, &vfs_aio_state);
|
||||
TALLOC_FREE(req);
|
||||
|
||||
DEBUG(10, ("pread_recv returned %d, err = %s\n", (int)nread,
|
||||
(nread == -1) ? strerror(err) : "no error"));
|
||||
(nread == -1) ? strerror(vfs_aio_state.error) : "no error"));
|
||||
|
||||
if (fsp == NULL) {
|
||||
DEBUG(3, ("%s: request cancelled (mid[%ju])\n",
|
||||
@ -797,7 +798,7 @@ static void aio_pread_smb2_done(struct tevent_req *req)
|
||||
/* Common error or success code processing for async or sync
|
||||
read returns. */
|
||||
|
||||
status = smb2_read_complete(subreq, nread, err);
|
||||
status = smb2_read_complete(subreq, nread, vfs_aio_state.error);
|
||||
|
||||
if (nread > 0) {
|
||||
fsp->fh->pos = aio_ex->offset + nread;
|
||||
@ -810,7 +811,7 @@ static void aio_pread_smb2_done(struct tevent_req *req)
|
||||
fsp_str_dbg(aio_ex->fsp),
|
||||
(double)aio_ex->offset,
|
||||
(unsigned int)nread,
|
||||
err, nt_errstr(status)));
|
||||
vfs_aio_state.error, nt_errstr(status)));
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
tevent_req_nterror(subreq, status);
|
||||
|
@ -190,14 +190,15 @@ static void smbd_smb2_flush_done(struct tevent_req *subreq)
|
||||
{
|
||||
struct tevent_req *req = tevent_req_callback_data(
|
||||
subreq, struct tevent_req);
|
||||
int ret, err;
|
||||
int ret;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
|
||||
decrement_outstanding_aio_calls();
|
||||
|
||||
ret = SMB_VFS_FSYNC_RECV(subreq, &err);
|
||||
ret = SMB_VFS_FSYNC_RECV(subreq, &vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (ret == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
|
@ -1587,8 +1587,9 @@ ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
struct smb_vfs_call_pread_state {
|
||||
ssize_t (*recv_fn)(struct tevent_req *req, int *err);
|
||||
ssize_t (*recv_fn)(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state);
|
||||
ssize_t retval;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_vfs_call_pread_done(struct tevent_req *subreq);
|
||||
@ -1626,27 +1627,26 @@ static void smb_vfs_call_pread_done(struct tevent_req *subreq)
|
||||
subreq, struct tevent_req);
|
||||
struct smb_vfs_call_pread_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_pread_state);
|
||||
int err;
|
||||
|
||||
state->retval = state->recv_fn(subreq, &err);
|
||||
state->retval = state->recv_fn(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (state->retval == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, state->vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, int *perrno)
|
||||
ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_vfs_call_pread_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_pread_state);
|
||||
int err;
|
||||
|
||||
if (tevent_req_is_unix_error(req, &err)) {
|
||||
*perrno = err;
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->retval;
|
||||
}
|
||||
|
||||
@ -1667,8 +1667,9 @@ ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
struct smb_vfs_call_pwrite_state {
|
||||
ssize_t (*recv_fn)(struct tevent_req *req, int *err);
|
||||
ssize_t (*recv_fn)(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state);
|
||||
ssize_t retval;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_vfs_call_pwrite_done(struct tevent_req *subreq);
|
||||
@ -1706,27 +1707,26 @@ static void smb_vfs_call_pwrite_done(struct tevent_req *subreq)
|
||||
subreq, struct tevent_req);
|
||||
struct smb_vfs_call_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_pwrite_state);
|
||||
int err;
|
||||
|
||||
state->retval = state->recv_fn(subreq, &err);
|
||||
state->retval = state->recv_fn(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (state->retval == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, state->vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, int *perrno)
|
||||
ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req,
|
||||
struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_vfs_call_pwrite_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_pwrite_state);
|
||||
int err;
|
||||
|
||||
if (tevent_req_is_unix_error(req, &err)) {
|
||||
*perrno = err;
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->retval;
|
||||
}
|
||||
|
||||
@ -1771,8 +1771,9 @@ int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
struct smb_vfs_call_fsync_state {
|
||||
int (*recv_fn)(struct tevent_req *req, int *err);
|
||||
int (*recv_fn)(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state);
|
||||
int retval;
|
||||
struct vfs_aio_state vfs_aio_state;
|
||||
};
|
||||
|
||||
static void smb_vfs_call_fsync_done(struct tevent_req *subreq);
|
||||
@ -1807,27 +1808,25 @@ static void smb_vfs_call_fsync_done(struct tevent_req *subreq)
|
||||
subreq, struct tevent_req);
|
||||
struct smb_vfs_call_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_fsync_state);
|
||||
int err;
|
||||
|
||||
state->retval = state->recv_fn(subreq, &err);
|
||||
state->retval = state->recv_fn(subreq, &state->vfs_aio_state);
|
||||
TALLOC_FREE(subreq);
|
||||
if (state->retval == -1) {
|
||||
tevent_req_error(req, err);
|
||||
tevent_req_error(req, state->vfs_aio_state.error);
|
||||
return;
|
||||
}
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
int SMB_VFS_FSYNC_RECV(struct tevent_req *req, int *perrno)
|
||||
int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state)
|
||||
{
|
||||
struct smb_vfs_call_fsync_state *state = tevent_req_data(
|
||||
req, struct smb_vfs_call_fsync_state);
|
||||
int err;
|
||||
|
||||
if (tevent_req_is_unix_error(req, &err)) {
|
||||
*perrno = err;
|
||||
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
|
||||
return -1;
|
||||
}
|
||||
*vfs_aio_state = state->vfs_aio_state;
|
||||
return state->retval;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user