Lines Matching +full:entry +full:- +full:method

1 // SPDX-License-Identifier: GPL-2.0-or-later
27 unsigned int method;
35 xa_for_each(&sess->ksmbd_chann_list, index, chann) {
36 xa_erase(&sess->ksmbd_chann_list, index);
40 xa_destroy(&sess->ksmbd_chann_list);
44 struct ksmbd_session_rpc *entry)
48 resp = ksmbd_rpc_close(sess, entry->id);
50 pr_err("Unable to close RPC pipe %d\n", entry->id);
53 ksmbd_rpc_id_free(entry->id);
54 kfree(entry);
59 struct ksmbd_session_rpc *entry;
62 xa_for_each(&sess->rpc_handle_list, index, entry) {
63 xa_erase(&sess->rpc_handle_list, index);
64 __session_rpc_close(sess, entry);
67 xa_destroy(&sess->rpc_handle_list);
93 struct ksmbd_session_rpc *entry, *old;
95 int method;
97 method = __rpc_method(rpc_name);
98 if (!method)
99 return -EINVAL;
101 entry = kzalloc(sizeof(struct ksmbd_session_rpc), GFP_KERNEL);
102 if (!entry)
103 return -ENOMEM;
105 entry->method = method;
106 entry->id = ksmbd_ipc_id_alloc();
107 if (entry->id < 0)
109 old = xa_store(&sess->rpc_handle_list, entry->id, entry, GFP_KERNEL);
113 resp = ksmbd_rpc_open(sess, entry->id);
118 return entry->id;
120 xa_erase(&sess->rpc_handle_list, entry->id);
122 ksmbd_rpc_id_free(entry->id);
124 kfree(entry);
125 return -EINVAL;
130 struct ksmbd_session_rpc *entry;
132 entry = xa_erase(&sess->rpc_handle_list, id);
133 if (entry)
134 __session_rpc_close(sess, entry);
139 struct ksmbd_session_rpc *entry;
141 entry = xa_load(&sess->rpc_handle_list, id);
142 return entry ? entry->method : 0;
150 if (sess->user)
151 ksmbd_free_user(sess->user);
154 ksmbd_destroy_file_table(&sess->file_table);
157 kfree(sess->Preauth_HashValue);
158 ksmbd_release_id(&session_ida, sess->id);
167 if (id == sess->id) {
168 sess->last_active = jiffies;
181 down_write(&conn->session_lock);
182 xa_for_each(&conn->sessions, id, sess) {
183 if (atomic_read(&sess->refcnt) <= 1 &&
184 (sess->state != SMB2_SESSION_VALID ||
186 sess->last_active + SMB2_SESSION_TIMEOUT))) {
187 xa_erase(&conn->sessions, sess->id);
188 hash_del(&sess->hlist);
193 up_write(&conn->session_lock);
200 sess->dialect = conn->dialect;
201 memcpy(sess->ClientGUID, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
203 return xa_err(xa_store(&conn->sessions, sess->id, sess, GFP_KERNEL));
210 chann = xa_erase(&sess->ksmbd_chann_list, (long)conn);
212 return -ENOENT;
224 if (conn->binding) {
230 xa_empty(&sess->ksmbd_chann_list)) {
231 hash_del(&sess->hlist);
232 down_write(&conn->session_lock);
233 xa_erase(&conn->sessions, sess->id);
234 up_write(&conn->session_lock);
235 if (atomic_dec_and_test(&sess->refcnt))
241 down_write(&conn->session_lock);
242 xa_for_each(&conn->sessions, id, sess) {
246 xa_for_each(&sess->ksmbd_chann_list, chann_id, chann) {
247 if (chann->conn != conn)
248 ksmbd_conn_set_exiting(chann->conn);
252 if (xa_empty(&sess->ksmbd_chann_list)) {
253 xa_erase(&conn->sessions, sess->id);
254 hash_del(&sess->hlist);
255 if (atomic_dec_and_test(&sess->refcnt))
259 up_write(&conn->session_lock);
268 down_read(&conn->session_lock);
269 sess = xa_load(&conn->sessions, id);
271 up_read(&conn->session_lock);
274 up_read(&conn->session_lock);
284 down_read(&conn->session_lock);
285 sess = xa_load(&conn->sessions, id);
287 sess->last_active = jiffies;
290 up_read(&conn->session_lock);
313 if (!sess && conn->binding)
315 if (sess && sess->state != SMB2_SESSION_VALID)
322 atomic_inc(&sess->refcnt);
330 if (atomic_read(&sess->refcnt) <= 0)
332 else if (atomic_dec_and_test(&sess->refcnt))
345 sess->id = sess_id;
346 memcpy(sess->Preauth_HashValue, conn->preauth_info->Preauth_HashValue,
348 list_add(&sess->preauth_entry, &conn->preauth_sess_table);
361 down_write(&conn->session_lock);
363 if (!prev_sess || prev_sess->state == SMB2_SESSION_EXPIRED)
366 prev_user = prev_sess->user;
368 strcmp(user->name, prev_user->name) ||
369 user->passkey_sz != prev_user->passkey_sz ||
370 memcmp(user->passkey, prev_user->passkey, user->passkey_sz))
379 ksmbd_destroy_file_table(&prev_sess->file_table);
380 prev_sess->state = SMB2_SESSION_EXPIRED;
383 up_write(&conn->session_lock);
390 return sess->id == id;
398 list_for_each_entry(sess, &conn->preauth_sess_table, preauth_entry) {
410 return -EINVAL;
411 sess->id = id;
427 if (ksmbd_init_file_table(&sess->file_table))
430 sess->last_active = jiffies;
431 sess->state = SMB2_SESSION_IN_PROGRESS;
433 xa_init(&sess->tree_conns);
434 xa_init(&sess->ksmbd_chann_list);
435 xa_init(&sess->rpc_handle_list);
436 sess->sequence_number = 1;
437 rwlock_init(&sess->tree_conns_lock);
438 atomic_set(&sess->refcnt, 2);
444 ida_init(&sess->tree_conn_ida);
447 hash_add(sessions_table, &sess->hlist, sess->id);
464 int id = -EINVAL;
467 id = ksmbd_acquire_smb2_tid(&sess->tree_conn_ida);
475 ksmbd_release_id(&sess->tree_conn_ida, id);