summaryrefslogtreecommitdiff
path: root/source3/smbd/conn_idle.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2020-03-12 09:47:26 -0700
committerJeremy Allison <jra@samba.org>2020-03-18 18:03:29 +0000
commit7891302ab8eeba8261b92171a4d429e2f538b89a (patch)
treec36f446e5ac01b1d52b52414be58455d72fabebe /source3/smbd/conn_idle.c
parent4f9e0459cd06f0332083a4a465f49b5f258838fa (diff)
downloadsamba-7891302ab8eeba8261b92171a4d429e2f538b89a.tar.gz
s3: smbd: Replace synchronous conn_force_tdis() with the async version.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/smbd/conn_idle.c')
-rw-r--r--source3/smbd/conn_idle.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c
index b54cdf82274..cf5a417bff7 100644
--- a/source3/smbd/conn_idle.c
+++ b/source3/smbd/conn_idle.c
@@ -77,27 +77,27 @@ bool conn_idle_all(struct smbd_server_connection *sconn, time_t t)
}
/****************************************************************************
- Forcibly unmount a share.
+ Forcibly unmount a share - async
All instances of the parameter 'sharename' share are unmounted.
The special sharename '*' forces unmount of all shares.
****************************************************************************/
+static struct tevent_req *conn_force_tdis_send(connection_struct *conn);
+static void conn_force_tdis_done(struct tevent_req *req);
+
void conn_force_tdis(
struct smbd_server_connection *sconn,
bool (*check_fn)(struct connection_struct *conn,
void *private_data),
void *private_data)
{
- connection_struct *conn, *next;
+ connection_struct *conn;
/* SMB1 and SMB 2*/
- for (conn = sconn->connections; conn; conn = next) {
+ for (conn = sconn->connections; conn; conn = conn->next) {
struct smbXsrv_tcon *tcon;
bool do_close = false;
- NTSTATUS status;
- uint64_t vuid = UID_FIELD_INVALID;
-
- next = conn->next;
+ struct tevent_req *req;
if (conn->tcon == NULL) {
continue;
@@ -114,34 +114,23 @@ void conn_force_tdis(
continue;
}
+ req = conn_force_tdis_send(conn);
+ if (req == NULL) {
+ DBG_WARNING("talloc_fail forcing async close of "
+ "share '%s'\n",
+ tcon->global->share_name);
+ continue;
+ }
+
DBG_WARNING("Forcing close of "
"share '%s' (wire_id=0x%08x)\n",
tcon->global->share_name,
tcon->global->tcon_wire_id);
- if (sconn->using_smb2) {
- vuid = conn->vuid;
- }
-
- conn = NULL;
- status = smbXsrv_tcon_disconnect(tcon, vuid);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("conn_force_tdis: "
- "smbXsrv_tcon_disconnect() of share '%s' "
- "(wire_id=0x%08x) failed: %s\n",
- tcon->global->share_name,
- tcon->global->tcon_wire_id,
- nt_errstr(status)));
- }
-
- TALLOC_FREE(tcon);
+ tevent_req_set_callback(req, conn_force_tdis_done, conn);
}
-
- change_to_root_user();
- reload_services(sconn, conn_snum_used, true);
}
-#if 0
struct conn_force_tdis_state {
struct tevent_queue *wait_queue;
};
@@ -286,4 +275,3 @@ static void conn_force_tdis_done(struct tevent_req *req)
change_to_root_user();
reload_services(sconn, conn_snum_used, true);
}
-#endif