return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
- subreq = smbd_smb2_query_directory_send(req, req->ev_ctx,
+ subreq = smbd_smb2_query_directory_send(req, req->sconn->ev_ctx,
req, in_fsp,
in_file_info_class,
in_flags,
static struct tevent_req *fetch_dos_mode_send(
TALLOC_CTX *mem_ctx,
- struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct files_struct *dir_fsp,
struct smb_filename **smb_fname,
uint32_t info_level,
static NTSTATUS fetch_dos_mode_recv(struct tevent_req *req);
struct smbd_smb2_query_directory_state {
- struct smb_vfs_ev_glue *evg;
struct tevent_context *ev;
struct smbd_smb2_request *smb2req;
uint64_t async_sharemode_count;
bool async_dosmode;
bool async_ask_sharemode;
int last_entry_off;
- struct pthreadpool_tevent *tp_chdir_safe;
size_t max_async_dosmode_active;
uint32_t async_dosmode_active;
bool done;
if (req == NULL) {
return NULL;
}
- state->evg = conn->user_vfs_evg;
state->ev = ev;
- state->tp_chdir_safe = smb_vfs_ev_glue_tp_chdir_safe(state->evg);
state->fsp = fsp;
state->smb2req = smb2req;
state->in_output_buffer_length = in_output_buffer_length;
if (state->info_level != SMB_FIND_FILE_NAMES_INFO) {
state->ask_sharemode = lp_smbd_search_ask_sharemode(SNUM(conn));
- state->async_dosmode = lp_parm_bool(
- SNUM(conn), "smbd", "async dosmode", false);
+ state->async_dosmode = lp_smbd_async_dosmode(SNUM(conn));
}
if (state->ask_sharemode && lp_clustering()) {
if (state->async_dosmode) {
size_t max_threads;
- max_threads = pthreadpool_tevent_max_threads(state->tp_chdir_safe);
-
- state->max_async_dosmode_active = lp_parm_ulong(
- SNUM(conn), "smbd", "max async dosmode",
- max_threads * 2);
+ max_threads = pthreadpool_tevent_max_threads(conn->sconn->pool);
+ if (max_threads == 0 || !per_thread_cwd_supported()) {
+ state->async_dosmode = false;
+ }
+ state->max_async_dosmode_active = lp_smbd_max_async_dosmode(
+ SNUM(conn));
if (state->max_async_dosmode_active == 0) {
- state->max_async_dosmode_active = 1;
+ state->max_async_dosmode_active = max_threads * 2;
}
}
buf = (uint8_t *)state->base_data + state->last_entry_off;
subreq = fetch_dos_mode_send(state,
- state->evg,
+ state->ev,
state->fsp,
&smb_fname,
state->info_level,
state->async_dosmode_active++;
outstanding_aio = pthreadpool_tevent_queued_jobs(
- state->tp_chdir_safe);
+ state->fsp->conn->sconn->pool);
if (outstanding_aio > state->max_async_dosmode_active) {
stop = true;
static struct tevent_req *fetch_dos_mode_send(
TALLOC_CTX *mem_ctx,
- struct smb_vfs_ev_glue *evg,
+ struct tevent_context *ev,
struct files_struct *dir_fsp,
struct smb_filename **smb_fname,
uint32_t info_level,
uint8_t *entry_marshall_buf)
{
- struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
struct tevent_req *req = NULL;
struct fetch_dos_mode_state *state = NULL;
struct tevent_req *subreq = NULL;
state->smb_fname = talloc_move(state, smb_fname);
- subreq = dos_mode_at_send(state, evg, dir_fsp, state->smb_fname);
+ subreq = dos_mode_at_send(state, ev, dir_fsp, state->smb_fname);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}