Motr  M0
session_foms.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_RPC
24 #include "lib/trace.h"
25 #include "lib/errno.h"
26 #include "lib/memory.h"
27 #include "lib/misc.h"
28 #include "lib/trace.h"
29 #include "lib/finject.h"
30 #include "stob/stob.h"
31 #include "net/net.h"
32 #include "rpc/rpc_internal.h"
33 #include "reqh/reqh_service.h"
34 
50 static void session_gen_fom_fini(struct m0_fom *fom)
51 {
53  m0_free(fom);
54 }
55 
61 static int session_gen_fom_create(struct m0_fop *fop, struct m0_fom **m,
62  struct m0_reqh *reqh)
63 {
65  const struct m0_fom_ops *fom_ops;
66  struct m0_fom *fom;
67  struct m0_fop_type *reply_fopt;
68  struct m0_fop *reply_fop;
69  int rc;
70 
71  M0_ENTRY("fop: %p", fop);
72 
74  if (gen == NULL) {
75  rc = M0_ERR(-ENOMEM);
76  goto out;
77  }
78  fom = &gen->ssf_fom_generic;
79 
81 
84 
85  } else if (fop->f_type == &m0_rpc_fop_conn_terminate_fopt) {
86 
89 
91 
94 
96 
99 
100  } else {
101  reply_fopt = NULL;
102  fom_ops = NULL;
103  }
104 
105  if (reply_fopt == NULL || fom_ops == NULL) {
106  rc = -EINVAL;
107  M0_LOG(M0_ERROR, "unsupported fop type '%s'\n",
108  fop->f_type->ft_name);
109  goto out;
110  }
111 
112  reply_fop = m0_fop_reply_alloc(fop, reply_fopt);
113  if (M0_FI_ENABLED("reply_fop_alloc_failed")) {
115  reply_fop = NULL;
116  }
117  if (reply_fop == NULL) {
118  rc = -ENOMEM;
119  goto out;
120  }
122  reqh);
123  *m = fom;
124  rc = 0;
125 
126 out:
127  if (rc != 0) {
128  m0_free(gen);
129  *m = NULL;
130  }
131  return M0_RC(rc);
132 }
133 
135  struct m0_fom *fom,
136  int next_state)
137 {
140 
141  M0_ENTRY("session: %p, state: %d", session, session_state(session));
144 
147  ret = M0_FSO_WAIT;
148  m0_fom_wait_on(fom, &session->s_sm.sm_chan, &fom->fo_cb);
149  }
150 
151  m0_fom_phase_set(fom, next_state);
152 
153  M0_LEAVE("ret: %d", ret);
154  return ret;
155 }
156 
160  .fo_home_locality = m0_rpc_session_default_home_locality
161 };
162 
165 };
166 
167 M0_INTERNAL size_t m0_rpc_session_default_home_locality(const struct m0_fom
168  *fom)
169 {
170  M0_PRE(fom != NULL);
171 
172  return m0_fop_opcode(fom->fo_fop);
173 }
174 
175 M0_INTERNAL int m0_rpc_fom_conn_establish_tick(struct m0_fom *fom)
176 {
179  struct m0_rpc_fop_conn_establish *request;
180  struct m0_rpc_item_header2 *header;
181  struct m0_fop *fop;
182  struct m0_fop *fop_rep;
183  struct m0_rpc_item *item;
184  struct m0_rpc_machine *machine;
185  struct m0_rpc_session *session0;
186  struct m0_rpc_conn *conn;
187  struct m0_rpc_conn *est_conn;
188  struct m0_fid *uniq_fid;
189  static struct m0_fom_timeout *fom_timeout = NULL;
190  int rc;
191 
192  M0_ENTRY("fom: %p", fom);
193  M0_PRE(fom != NULL);
194  M0_PRE(fom->fo_fop != NULL && fom->fo_rep_fop != NULL);
195 
196  if (M0_FI_ENABLED("sleep-for-resend")) {
203  M0_ASSERT(rc == 0);
204  M0_LEAVE();
205  return M0_FSO_WAIT;
206  }
207  if (M0_FI_ENABLED("free-timer") && fom_timeout != NULL &&
208  fom_timeout->to_cb.fc_fom == fom) {
209  /* don't touch not our timer (from resend) */
212  fom_timeout = NULL;
213  m0_fi_disable(__func__, "free-timer");
214  }
215 
216  fop = fom->fo_fop;
217  request = m0_fop_data(fop);
218  M0_ASSERT(request != NULL);
219 
220  fop_rep = fom->fo_rep_fop;
221  reply = m0_fop_data(fop_rep);
222  M0_ASSERT(reply != NULL);
223 
224  item = &fop->f_item;
225  header = &item->ri_header;
226  /*
227  * On receiver side CONN_ESTABLISH fop is wrapped in
228  * m0_rpc_fop_conn_etablish_ctx object.
229  * See conn_establish_item_decode()
230  */
232  M0_ASSERT(ctx != NULL &&
233  ctx->cec_sender_ep != NULL);
234 
236  if (M0_FI_ENABLED("conn-alloc-failed"))
237  m0_free0(&conn);
238  if (conn == NULL) {
239  goto ret;
240  /* no reply if conn establish failed.
241  See [4] at end of this function. */
242  }
243 
244  uniq_fid = &fom->fo_service->rs_service_fid;
248  if (est_conn != NULL) {
249  /* This connection should aready be setup. */
250  M0_ASSERT(m0_rpc_conn_invariant(est_conn));
251 
252  /* This is a duplicate request that was accepted
253  after original conn-establish request was accepted but
254  before the conn-establish operation completed.
255 
256  It seems that server connect reply was dropped by client
257  due to the lack of free buffers. Let us resuse the existing
258  connection.
259  */
260  M0_LOG(M0_INFO, "Duplicate conn-establish request %p", item);
261  m0_free(conn);
262 
263  /*
264  * Reuse existing conn and proceed just like this is very
265  * first connection attempt.
266  */
267  conn = est_conn;
268  rc = 0;
269  } else {
270  rc = m0_rpc_rcv_conn_init(conn, ctx->cec_sender_ep, machine,
271  &header->osr_uuid);
272  if (rc == 0) {
273  conn->c_sender_id = m0_rpc_id_generate(uniq_fid);
275  }
276  }
277  if (rc == 0) {
280  /* freed at m0_rpc_item_process_reply() */
282  }
284 
285  if (rc == 0) {
286  reply->rcer_sender_id = conn->c_sender_id;
287  reply->rcer_rc = 0;
288  M0_LOG(M0_INFO, "Conn established: conn [%p] id [%lu]\n", conn,
289  (unsigned long)conn->c_sender_id);
290  m0_rpc_reply_post(&fop->f_item, &fop_rep->f_item);
291  } else {
292  M0_ASSERT(conn != NULL);
293  m0_free(conn);
294  /* No reply is sent if conn establish failed. See [4] */
295  M0_LOG(M0_ERROR, "Conn establish failed: rc [%d]\n", rc);
296  }
297 
298 ret:
300  M0_LEAVE();
301  return M0_FSO_WAIT;
302 }
303 
304 /*
305  * FOM session create
306  */
307 
311  .fo_home_locality = m0_rpc_session_default_home_locality
312 };
313 
316 };
317 
319 {
321  struct m0_rpc_fop_session_establish *request;
322  struct m0_rpc_item *item;
323  struct m0_fop *fop;
324  struct m0_fop *fop_rep;
325  struct m0_rpc_session *session;
326  struct m0_rpc_conn *conn;
327  struct m0_rpc_machine *machine;
328  struct m0_fid *uniq_fid;
329  int rc;
330 
331  M0_ENTRY("fom: %p", fom);
332  M0_PRE(fom != NULL);
333  M0_PRE(fom->fo_fop != NULL && fom->fo_rep_fop != NULL);
334 
335  fop = fom->fo_fop;
336  request = m0_fop_data(fop);
337  M0_ASSERT(request != NULL);
338 
339  fop_rep = fom->fo_rep_fop;
340  reply = m0_fop_data(fop_rep);
341  M0_ASSERT(reply != NULL);
342 
343  item = &fop->f_item;
345  conn = item2conn(item);
346  M0_ASSERT(conn != NULL);
348 
350  if (M0_FI_ENABLED("session-alloc-failed"))
351  m0_free0(&session);
352  if (session == NULL) {
353  rc = M0_ERR(-ENOMEM);
354  goto out;
355  }
356  /*
357  Drop this session establish FOP.
358 
359  Assume the following case:
360  1) time t1 < t2 < t3
361 
362  2) t1: RPC item which corresponds to session establish FOP is
363  received.
364 
365  t2: RPC item which corresponds to connection terminate FOP is
366  received. Connection terminate FOP is processed inside request
367  handler: m0_rpc_fom_conn_terminate_tick() is called.
368 
369  t3: Session establish FOP is processed inside request hander,
370  m0_rpc_fom_session_establish_tick() is called.
371 
372  3) NOTE: Listed above FOPs correspond to RPC items, which were
373  delivered onto RPC session0 of current RPC connection.
374 
375  Analysis:
376 
377  After sending connection termination FOP, sender side is no longer
378  waiting for connection establish FOP reply, so it's easy just to drop
379  this reply in this tick.
380 
381  In other case, we can think to process (1-3) inside
382  m0_rpc_fom_conn_terminate_tick() so that we wait session to
383  establish, and only then terminate current connection. From the first
384  sight, this wait stage can be done by waiting session0 to become
385  IDLE, but there're two RPC items, pending on this session (terminate
386  connection item, establish session item), so session0 never becomes
387  IDLE here.
388  */
393  rc = M0_RC(-ECONNREFUSED);
394  goto out2;
395  }
396  uniq_fid = &fom->fo_service->rs_service_fid;
398  if (rc == 0) {
399  do {
401  } while (session->s_session_id <= SESSION_ID_MIN ||
404  reply->rser_session_id = session->s_session_id;
405  }
407 
408 out:
409  reply->rser_sender_id = request->rse_sender_id;
410  reply->rser_rc = rc;
411  if (rc != 0)
412  reply->rser_session_id = SESSION_ID_INVALID;
413  m0_rpc_reply_post(&fop->f_item, &fop_rep->f_item);
414 out2:
415  if (rc != 0 && session != NULL)
416  m0_free(session);
418  M0_LEAVE();
419  return M0_FSO_WAIT;
420 }
421 
422 /*
423  * FOM session terminate
424  */
425 
429  .fo_home_locality = m0_rpc_session_default_home_locality
430 };
431 
434 };
435 
437 {
440  struct m0_rpc_fop_session_terminate *request;
441  struct m0_rpc_item *item;
442  struct m0_rpc_session *session;
443  struct m0_rpc_machine *machine;
444  struct m0_rpc_conn *conn;
445  uint64_t session_id;
446  int rc;
447 
448  M0_ENTRY("fom: %p, fom_phase: %d", fom, m0_fom_phase(fom));
449  M0_PRE(fom != NULL);
450  M0_PRE(fom->fo_fop != NULL && fom->fo_rep_fop != NULL);
451 
452  gen = container_of(fom,
454  ssf_fom_generic);
455  M0_ASSERT(gen != NULL);
456 
457  request = m0_fop_data(fom->fo_fop);
458  M0_ASSERT(request != NULL);
459 
460  reply = m0_fop_data(fom->fo_rep_fop);
461  M0_ASSERT(reply != NULL);
462 
463  reply->rstr_sender_id = request->rst_sender_id;
464  reply->rstr_session_id = session_id = request->rst_session_id;
465 
466  item = &fom->fo_fop->f_item;
468 
469  conn = item2conn(item);
471 
474 
475  /* The following switch is an asynchronous cycle and it
476  * does the following:
477  *
478  * wait until session_state(session) == M0_RPC_SESSION_IDLE
479  * finalize(session)
480  */
481  rc = 0;
482  session = NULL;
483  switch(m0_fom_phase(fom)) {
485  gen->ssf_term_session = NULL;
488  M0_LEAVE();
489  return M0_FSO_AGAIN;
490 
493  rc = -EINVAL;
494  break;
495  }
496  if (gen->ssf_term_session == NULL)
497  gen->ssf_term_session = m0_rpc_session_search_and_pop(
498  conn, session_id);
499  session = gen->ssf_term_session;
500  if (session == NULL) {
501  rc = -ENOENT;
502  break;
503  }
506  if (rc == M0_FSO_WAIT) {
507  M0_LOG(M0_DEBUG, "session: %p, hold_cnt: %d, "
508  "wait for session to become idle",
511  return rc;
512  }
513  M0_LOG(M0_DEBUG, "Actual session remove. session: %p, "
514  "hold_cnt: %d", session, session->s_hold_cnt);
520 
522  m0_free(session);
523 
524  default:
525  ;
526  }
527 
529 
530  reply->rstr_rc = rc;
531  M0_LOG(M0_DEBUG, "Session terminate %s: session [%p] rc [%d]",
532  (rc == 0) ? "successful" : "failed", session, rc);
533 
534  /*
535  * Note: request is received on SESSION_0, which is different from
536  * current session being terminated. Reply will also go on SESSION_0.
537  */
539  m0_rpc_reply_post(&fom->fo_fop->f_item, &fom->fo_rep_fop->f_item);
540 
541  M0_LEAVE();
542  return M0_FSO_WAIT;
543 }
544 
545 /*
546  * FOM RPC connection terminate
547  */
551  .fo_home_locality = m0_rpc_session_default_home_locality
552 };
553 
556 };
557 
558 static void conn_cleanup_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
559 {
560  struct m0_rpc_conn *conn;
561 
562  conn = container_of(ast, struct m0_rpc_conn, c_ast);
564 }
565 
567 {
568  struct m0_rpc_conn *conn;
569 
570  M0_ENTRY("item: %p", item);
571 
572  M0_PRE(item != NULL &&
573  item->ri_session != NULL &&
575  item2conn(item) != NULL);
577 
578  conn = item2conn(item);
579  if (!conn->c_ast_in_progress) {
580  conn->c_ast_in_progress = true;
583  }
584  M0_LEAVE();
585 }
586 
589 };
590 
591 M0_INTERNAL int m0_rpc_fom_conn_terminate_tick(struct m0_fom *fom)
592 {
595  struct m0_rpc_fop_conn_terminate *request;
596  struct m0_rpc_item *item;
597  struct m0_fop *fop;
598  struct m0_fop *fop_rep;
599  struct m0_rpc_conn *conn;
600  struct m0_rpc_machine *machine;
601  struct m0_rpc_session *session;
602 
603  M0_ENTRY("fom: %p", fom);
604  M0_PRE(fom != NULL);
605  M0_PRE(fom->fo_fop != NULL && fom->fo_rep_fop != NULL);
606 
607  gen = M0_AMB(gen, fom, ssf_fom_generic);
608  fop = fom->fo_fop;
609  fop_rep = fom->fo_rep_fop;
610  request = m0_fop_data(fop);
611  reply = m0_fop_data(fop_rep);
612 
613  item = &fop->f_item;
614  conn = item2conn(item);
616 
617  /* The following switch is an asynchronous cycle and it
618  * does the following:
619  *
620  * for (session : connection) {
621  * wait until session_state(session) == M0_RPC_SESSION_IDLE
622  * finalize(session)
623  * }
624  */
625  switch(m0_fom_phase(fom)) {
627  gen->ssf_term_session = NULL;
629  return M0_FSO_AGAIN;
630 
633 
634  if (gen->ssf_term_session == NULL) {
636  gen->ssf_term_session = session;
637  if (session != NULL) {
638  int rc;
639  M0_LOG(M0_DEBUG, "Arming connection fom");
643  return rc;
644  }
645  } else {
646  M0_LOG(M0_DEBUG, "Session is ready for termination");
647  session = gen->ssf_term_session;
648  M0_ASSERT(session != NULL);
655  m0_free(session);
656  gen->ssf_term_session = NULL;
657  } else {
658  M0_LOG(M0_DEBUG, "Session [%p] busy.", session);
659  }
660 
662  M0_LEAVE();
663  return M0_FSO_AGAIN;
664  }
665 
666  default:
667  ;
668  }
669 
670  reply->ctr_sender_id = request->ct_sender_id;
671  switch (conn_state(conn)) {
672  case M0_RPC_CONN_ACTIVE:
675  break;
677  reply->ctr_rc = -EALREADY;
678  break;
680  reply->ctr_rc = -EPERM;
681  break;
682  default:
683  M0_IMPOSSIBLE("Invalid state");
684  }
686 
688  m0_rpc_reply_post(&fop->f_item, &fop_rep->f_item);
689 
690  /*
691  * In memory state of conn is not cleaned up, at this point.
692  * conn will be finalised and freed in the ->rio_sent()
693  * callback of &fop_rep->f_item item.
694  * see: conn_terminate_reply_sent_cb, conn_cleanup_ast()
695  */
697  M0_LEAVE();
698  return M0_FSO_WAIT;
699 }
700 
703 /*
704  * Local variables:
705  * c-indentation-style: "K&R"
706  * c-basic-offset: 8
707  * tab-width: 8
708  * fill-column: 80
709  * scroll-step: 1
710  * End:
711  */
static struct m0_rpc_session session0
Definition: session.c:37
uint32_t m0_fop_opcode(const struct m0_fop *fop)
Definition: fop.c:226
#define M0_PRE(cond)
M0_INTERNAL void m0_rpc_session_fini_locked(struct m0_rpc_session *session)
Definition: session.c:310
struct m0_fop_type m0_rpc_fop_session_terminate_rep_fopt
Definition: session_fops.c:127
static int fom_timeout(struct m0_fom *fom)
Definition: fom_generic.c:553
uint64_t c_nr_sessions
Definition: conn.h:301
#define NULL
Definition: misc.h:38
const struct m0_fom_ops m0_rpc_fom_conn_terminate_ops
Definition: session_foms.c:548
static struct m0_addb2_mach * m
Definition: consumer.c:38
#define ergo(a, b)
Definition: misc.h:293
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
Definition: sm.h:506
Definition: beck.c:170
M0_INTERNAL struct m0_rpc_conn * m0_rpc_machine_find_conn(const struct m0_rpc_machine *machine, const struct m0_rpc_item *item)
Definition: rpc_machine.c:836
static struct m0_sm_group * grp
Definition: bytecount.c:38
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
static int session_gen_fom_create(struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh)
Definition: session_foms.c:61
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: sm.c:135
struct m0_fom_type_ops m0_rpc_fom_session_establish_type_ops
Definition: session_foms.c:314
M0_EXTERN struct m0_rpc_session * m0_rpc_conn_session0(const struct m0_rpc_conn *conn)
Definition: conn.c:749
struct m0_fop_type m0_rpc_fop_session_establish_rep_fopt
Definition: session_fops.c:125
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
const struct m0_fom_ops m0_rpc_fom_session_establish_ops
Definition: session_foms.c:308
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
struct m0_fom_type_ops m0_rpc_fom_session_terminate_type_ops
Definition: session_foms.c:432
M0_INTERNAL void m0_fom_wait_on(struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
Definition: fom.c:1490
Definition: sm.h:504
M0_INTERNAL int m0_rpc_rcv_conn_terminate(struct m0_rpc_conn *conn)
Definition: conn.c:1217
#define container_of(ptr, type, member)
Definition: misc.h:33
static struct m0_rpc_session session
Definition: formation2.c:38
static struct m0_rpc_item * item
Definition: item.c:56
M0_INTERNAL struct m0_rpc_session * m0_rpc_session_pop(const struct m0_rpc_conn *conn)
Definition: conn.c:790
m0_fom_phase
Definition: fom.h:372
M0_INTERNAL bool m0_rpc_conn_invariant(const struct m0_rpc_conn *conn)
Definition: conn.c:183
M0_INTERNAL uint64_t m0_rpc_id_generate(const struct m0_fid *uniq_fid)
Definition: session_utils.c:96
struct m0_fom_type ft_fom_type
Definition: fop.h:232
static const struct m0_rpc_item_ops conn_terminate_reply_item_ops
Definition: session_foms.c:587
struct m0_sm_group rm_sm_grp
Definition: rpc_machine.h:82
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
M0_INTERNAL int m0_fom_timeout_wait_on(struct m0_fom_timeout *to, struct m0_fom *fom, m0_time_t deadline)
Definition: fom.c:1566
uint32_t s_hold_cnt
Definition: session.h:320
void m0_fom_init(struct m0_fom *fom, const struct m0_fom_type *fom_type, const struct m0_fom_ops *ops, struct m0_fop *fop, struct m0_fop *reply, struct m0_reqh *reqh)
Definition: fom.c:1372
M0_INTERNAL bool m0_rpc_machine_is_locked(const struct m0_rpc_machine *machine)
Definition: rpc_machine.c:565
struct m0_fop_type * f_type
Definition: fop.h:81
const struct m0_fom_ops m0_rpc_fom_session_terminate_ops
Definition: session_foms.c:426
struct m0_rpc_machine * c_rpc_machine
Definition: conn.h:278
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_rpc_machine_unlock(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:558
M0_INTERNAL void session_state_set(struct m0_rpc_session *session, int state)
Definition: session.c:131
static void conn_cleanup_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: session_foms.c:558
uint64_t c_sender_id
Definition: conn.h:269
Definition: trace.h:482
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
const char * ft_name
Definition: fop.h:225
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
Definition: finject.c:485
M0_INTERNAL int m0_rpc_fom_conn_terminate_tick(struct m0_fom *fom)
Definition: session_foms.c:591
M0_INTERNAL void m0_rpc_session_hold_busy(struct m0_rpc_session *session)
Definition: session.c:782
void m0_fom_fini(struct m0_fom *fom)
Definition: fom.c:1324
#define m0_free0(pptr)
Definition: memory.h:77
#define M0_ASSERT(cond)
struct m0_rpc_item_header2 ri_header
Definition: item.h:193
bool c_ast_in_progress
Definition: conn.h:333
static struct m0_fop reply_fop
Definition: fsync.c:64
M0_INTERNAL int m0_rpc_fom_session_terminate_tick(struct m0_fom *fom)
Definition: session_foms.c:436
struct m0_fom_type_ops m0_rpc_fom_conn_establish_type_ops
Definition: session_foms.c:163
M0_INTERNAL int m0_rpc_rcv_conn_init(struct m0_rpc_conn *conn, struct m0_net_end_point *ep, struct m0_rpc_machine *machine, const struct m0_uint128 *uuid)
Definition: conn.c:525
M0_INTERNAL int session_state(const struct m0_rpc_session *session)
Definition: session.c:141
struct m0_fom_type_ops m0_rpc_fom_conn_terminate_type_ops
Definition: session_foms.c:554
M0_INTERNAL struct m0_rpc_machine * session_machine(const struct m0_rpc_session *s)
Definition: session.c:147
Definition: reqh.h:94
Definition: dump.c:103
M0_INTERNAL size_t m0_rpc_session_default_home_locality(const struct m0_fom *fom)
Definition: session_foms.c:167
void m0_rpc_reply_post(struct m0_rpc_item *request, struct m0_rpc_item *reply)
Definition: rpc.c:135
struct m0_rpc_conn conn
Definition: fsync.c:96
void(* rio_sent)(struct m0_rpc_item *item)
Definition: item.h:267
struct m0_rpc_machine machine
Definition: mdstore.c:58
static struct fdmi_ctx ctx
Definition: main.c:80
static int rpc_tick_ret(struct m0_rpc_session *session, struct m0_fom *fom, int next_state)
Definition: session_foms.c:134
struct m0_sm s_sm
Definition: session.h:325
static void session_gen_fom_fini(struct m0_fom *fom)
Definition: session_foms.c:50
struct m0_fop * m0_fop_reply_alloc(struct m0_fop *req, struct m0_fop_type *rept)
Definition: fop.c:129
M0_INTERNAL void m0_rpc_conn_terminate_reply_sent(struct m0_rpc_conn *conn)
Definition: conn.c:1237
Definition: fom.h:481
struct m0_sm_ast c_ast
Definition: conn.h:330
M0_INTERNAL void conn_state_set(struct m0_rpc_conn *conn, int state)
Definition: conn.c:167
struct m0_reqh reqh
Definition: rm_foms.c:48
M0_INTERNAL void m0_fom_timeout_fini(struct m0_fom_timeout *to)
Definition: fom.c:1539
struct m0_fop_type m0_rpc_fop_conn_terminate_fopt
Definition: session_fops.c:122
struct m0_fop_type m0_rpc_fop_session_establish_fopt
Definition: session_fops.c:124
struct m0_fop_type m0_rpc_fop_conn_establish_rep_fopt
Definition: session_fops.c:121
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
m0_fom_phase_outcome
Definition: fom.h:625
M0_INTERNAL void m0_rpc_machine_lock(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:551
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_chan sm_chan
Definition: sm.h:331
const struct m0_rpc_item_ops * ri_ops
Definition: item.h:149
m0_time_t m0_time_from_now(uint64_t secs, long ns)
Definition: time.c:96
M0_INTERNAL int m0_rpc_session_init_locked(struct m0_rpc_session *session, struct m0_rpc_conn *conn)
Definition: session.c:223
static void conn_terminate_reply_sent_cb(struct m0_rpc_item *item)
Definition: session_foms.c:566
struct m0_rpc_session * ri_session
Definition: item.h:147
const struct m0_fom_ops m0_rpc_fom_conn_establish_ops
Definition: session_foms.c:157
static struct m0_fop * fop
Definition: item.c:57
void(* fo_fini)(struct m0_fom *fom)
Definition: fom.h:657
M0_INTERNAL int m0_rpc_fom_session_establish_tick(struct m0_fom *fom)
Definition: session_foms.c:318
Definition: nucleus.c:42
M0_INTERNAL int m0_rpc_rcv_session_terminate(struct m0_rpc_session *session)
Definition: session.c:822
#define out(...)
Definition: gen.c:41
void m0_fom_phase_set(struct m0_fom *fom, int phase)
Definition: fom.c:1688
M0_INTERNAL void m0_fom_timeout_init(struct m0_fom_timeout *to)
Definition: fom.c:1532
struct m0_fop_type m0_rpc_fop_session_terminate_fopt
Definition: session_fops.c:126
struct m0_rpc_machine * ri_rmachine
Definition: item.h:160
static struct m0_dtm_oper_descr reply
Definition: transmit.c:94
uint64_t s_session_id
Definition: session.h:309
void m0_free(void *data)
Definition: memory.c:146
void m0_fop_put(struct m0_fop *fop)
Definition: fop.c:177
struct m0_rpc_item f_item
Definition: fop.h:83
struct m0_fop_type m0_rpc_fop_conn_establish_fopt
Definition: session_fops.c:120
int32_t rc
Definition: trigger_fop.h:47
M0_INTERNAL int m0_rpc_fom_conn_establish_tick(struct m0_fom *fom)
Definition: session_foms.c:175
M0_INTERNAL struct m0_rpc_session * m0_rpc_session_search_and_pop(const struct m0_rpc_conn *conn, uint64_t session_id)
Definition: conn.c:772
Definition: fop.h:79
static struct m0_rpc_conn * item2conn(const struct m0_rpc_item *item)
Definition: rpc_internal.h:95
static int conn_state(const struct m0_rpc_conn *conn)
Definition: conn_internal.h:66
struct m0_fop_type m0_rpc_fop_conn_terminate_rep_fopt
Definition: session_fops.c:123
#define M0_IMPOSSIBLE(fmt,...)