Motr  M0
fom_generic.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_FOP
24 #include "lib/trace.h"
25 
26 #include "lib/errno.h"
27 #include "lib/assert.h"
28 #include "lib/memory.h"
29 #include "lib/misc.h"
30 #include "lib/string.h"
31 #include "stob/stob.h"
32 #include "net/net.h"
33 #include "fop/fop.h"
34 #include "dtm/dtm.h"
35 #include "rpc/rpc.h"
36 #include "rpc/rpc_opcodes.h" /* M0_REQH_ERROR_REPLY_OPCODE */
37 #include "rpc/item_internal.h" /* m0_rpc_item_is_update */
38 #include "reqh/reqh.h"
39 #include "fop/fom_generic.h"
40 #include "fop/fom_generic_xc.h"
41 #include "addb2/addb2.h"
42 #include "addb2/identifier.h"
43 #include "dtm0/service.h" /* m0_dtm0_is_a_volatile_dtm */
44 
51 M0_EXPORTED(m0_fop_generic_reply_fopt);
52 
53 M0_INTERNAL void m0_fom_generic_fini(void)
54 {
56 }
57 
58 M0_INTERNAL int m0_fom_generic_init(void)
59 {
61  .name = "generic-reply",
63  .xt = m0_fop_generic_reply_xc,
64  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
65  return 0;
66 }
67 
68 M0_INTERNAL void m0_fom_mod_rep_fill(struct m0_fop_mod_rep *rep,
69  struct m0_fom *fom)
70 {
71  rep->fmr_remid.tri_txid = m0_fom_tx(fom)->t_id;
72  rep->fmr_remid.tri_locality = fom->fo_loc_idx;
73 }
74 
76 {
78 }
80 
82 {
84  int32_t rc;
85 
86  M0_PRE(reply != NULL);
89  rc = reply_fop->gr_rc;
90  if (rc != 0)
91  M0_LOG(M0_ERROR, "Receiver reported error: %d \"%s\"",
92  rc,
93  (char*)reply_fop->gr_msg.s_buf ?: strerror(rc));
94  return M0_RC(rc);
95  } else
96  return 0;
97 }
98 M0_EXPORTED(m0_rpc_item_generic_reply_rc);
99 
100 static bool fom_is_update(const struct m0_fom *fom)
101 {
102  /* The rest of condition will always work for non-DTM0 services. */
103  return !m0_dtm0_is_a_volatile_dtm(fom->fo_service) &&
105 }
106 
120  int (*fpd_action) (struct m0_fom *fom);
129  const char *fpd_name;
137  uint64_t fpd_pre_phase;
138 };
139 
148 static int fom_phase_init(struct m0_fom *fom)
149 {
150  return M0_FSO_AGAIN;
151 }
152 
157 static int fom_authen(struct m0_fom *fom)
158 {
159  return M0_FSO_AGAIN;
160 }
161 
166 static int fom_authen_wait(struct m0_fom *fom)
167 {
168  return M0_FSO_AGAIN;
169 }
170 
175 static int fom_loc_resource(struct m0_fom *fom)
176 {
177  return M0_FSO_AGAIN;
178 }
179 
184 static int fom_loc_resource_wait(struct m0_fom *fom)
185 {
186  return M0_FSO_AGAIN;
187 }
188 
192 static int fom_dist_resource(struct m0_fom *fom)
193 {
194  return M0_FSO_AGAIN;
195 }
196 
201 static int fom_dist_resource_wait(struct m0_fom *fom)
202 {
203  return M0_FSO_AGAIN;
204 }
205 
210 static int fom_obj_check(struct m0_fom *fom)
211 {
212  return M0_FSO_AGAIN;
213 }
214 
219 static int fom_obj_check_wait(struct m0_fom *fom)
220 {
221  return M0_FSO_AGAIN;
222 }
223 
229 static int fom_auth(struct m0_fom *fom)
230 {
231  return M0_FSO_AGAIN;
232 }
233 
238 static int fom_auth_wait(struct m0_fom *fom)
239 {
240  return M0_FSO_AGAIN;
241 }
242 
248 static int fom_tx_init(struct m0_fom *fom)
249 {
250  uint64_t tx_sm_id;
251  uint64_t phase_sm_id;
252 
253  if (fom_is_update(fom)) {
254  m0_dtx_init(&fom->fo_tx, m0_fom_reqh(fom)->rh_beseg->bs_domain,
255  &fom->fo_loc->fl_group);
256 
257  phase_sm_id = m0_sm_id_get(&fom->fo_sm_phase);
258  tx_sm_id = m0_sm_id_get(&fom->fo_tx.tx_betx.t_sm);
259  M0_ADDB2_ADD(M0_AVI_FOM_TO_TX, phase_sm_id, tx_sm_id);
260  }
261  return M0_FSO_AGAIN;
262 }
263 
268 static int fom_tx_open(struct m0_fom *fom)
269 {
270  if (fom_is_update(fom)) {
271  struct m0_dtx *dtx = &fom->fo_tx;
272 
274  if (!fom->fo_local) {
275  int rc;
276  rc = m0_fop_fol_add(fom->fo_fop, fom->fo_rep_fop, dtx);
277  if (rc < 0)
278  return M0_RC(rc);
279  }
280  m0_dtx_open(dtx);
281  }
282  return M0_FSO_AGAIN;
283 }
284 
289 static int fom_tx_wait(struct m0_fom *fom)
290 {
291  if (fom_is_update(fom)) {
292  struct m0_be_tx *tx = m0_fom_tx(fom);
293 
294  M0_ENTRY("fom=%p, tx_state %d", fom, m0_be_tx_state(tx));
298  M0_BTS_FAILED)));
299 
300  if (m0_be_tx_state(tx) == M0_BTS_FAILED)
301  return M0_RC(tx->t_sm.sm_rc);
302  else if (M0_IN(m0_be_tx_state(tx), (M0_BTS_OPENING,
303  M0_BTS_GROUPING))) {
304  m0_fom_wait_on(fom, &tx->t_sm.sm_chan, &fom->fo_cb);
305  M0_LEAVE();
306  return M0_FSO_WAIT;
307  } else
308  m0_dtx_opened(&fom->fo_tx);
309  }
310  M0_LEAVE();
311  return M0_FSO_AGAIN;
312 }
313 
318 static void generic_reply_build(struct m0_fom *fom)
319 {
320  struct m0_fop *rfop = fom->fo_rep_fop;
321  struct m0_fop_generic_reply *out_fop;
322 
323  if (rfop == NULL)
324  rfop = m0_fop_reply_alloc(fom->fo_fop,
326  if (rfop != NULL) {
327  fom->fo_rep_fop = rfop;
328  M0_PRE(rfop->f_type->ft_xt->xct_child[0].xf_type == &M0_XT_U32);
329  out_fop = m0_fop_data(rfop);
330  out_fop->gr_rc = m0_fom_rc(fom);
331  }
332 }
333 
342 static int fom_failure(struct m0_fom *fom)
343 {
344  int rc = m0_fom_rc(fom);
345  struct m0_dtx *tx = &fom->fo_tx;
346 
347  if (rc != 0) {
348  M0_LOG(M0_NOTICE, "fom_rc=%d", rc);
349  /*
350  * A local fom does not have request fop or reply fop.
351  */
352  if (fom->fo_fop != NULL && !fom->fo_local)
354  else
355  M0_LOG(M0_NOTICE, "fom_rc=%d. Local FOM has no fop/rpc",
356  rc);
357  }
358  /*
359  * If transaction was initialised, but not opened, finalise it.
360  */
361  if (tx->tx_state == M0_DTX_INIT) {
362  struct m0_be_tx *betx = &tx->tx_betx;
367  if (m0_be_tx_state(betx) == M0_BTS_PREPARE) {
369  m0_be_tx_open(betx);
370  }
372  m0_dtx_fini(tx);
373  }
374  if (tx->tx_state == M0_DTX_INVALID)
392 
393  return M0_FSO_AGAIN;
394 }
395 
399 static int fom_success(struct m0_fom *fom)
400 {
401  return M0_FSO_AGAIN;
402 }
403 
407 static int fom_fol_rec_add(struct m0_fom *fom)
408 {
409  int rc;
410 
411  if (fom_is_update(fom) &&
412  !fom->fo_local && fom->fo_tx.tx_state == M0_DTX_OPEN) {
414  /*
415  * FOL record itself might fail to encode due to insufficient
416  * BE tx payload buffer, but it's a bug in credit caclulation.
417  * Other reasons to fail are bugs in the code.
418  * In any case there is no way to handle failure of adding FOL
419  * record at this point, so the best option is to terminate the
420  * program.
421  */
422  M0_ASSERT_INFO(rc == 0,
423  "m0_fom_fol_rec_add() failed: rc=%d", rc);
424  /*
425  * This m0_be_tx_get() is needed because
426  * m0_fom_fdmi_record_post() in m0_fom_tx_logged_wait() may
427  * take another reference on the transaction, which is not
428  * possible if transaction is in M0_BTS_DONE state already. To
429  * prevent this the reference is taken here and released just
430  * after m0_fom_fdmi_record_post().
431  */
432  m0_be_tx_get(&fom->fo_tx.tx_betx);
433  }
434  return M0_FSO_AGAIN;
435 }
436 
441 static int fom_tx_commit(struct m0_fom *fom)
442 {
443  struct m0_dtx *dtx = &fom->fo_tx;
444  struct m0_be_tx *tx = m0_fom_tx(fom);
445 
446  if (!fom_is_update(fom))
447  ;
448  else if (dtx->tx_state == M0_DTX_INIT) {
449  m0_dtx_fini(dtx);
450  } else if (M0_IN(dtx->tx_state, (M0_DTX_OPEN, M0_DTX_DONE))){
452  m0_dtx_done(dtx);
453  }
454  return M0_FSO_AGAIN;
455 }
456 
461 M0_INTERNAL int m0_fom_tx_logged_wait(struct m0_fom *fom)
462 {
463  struct m0_dtx *dtx = &fom->fo_tx;
464  struct m0_be_tx *tx = m0_fom_tx(fom);
465 
466  M0_ENTRY();
467  if (!fom_is_update(fom))
468  ;
469  else if (dtx->tx_state == M0_DTX_DONE) {
470  if (m0_be_tx_state(tx) >= M0_BTS_LOGGED) {
471  if (!fom->fo_local) {
473  /*
474  * This reference is taken in fom_fol_rec_add().
475  */
476  m0_be_tx_put(&fom->fo_tx.tx_betx);
477  }
478  return M0_FSO_AGAIN;
479  }
480  m0_fom_wait_on(fom, &tx->t_sm.sm_chan, &fom->fo_cb);
481  return M0_FSO_WAIT;
482  }
483  return M0_FSO_AGAIN;
484 }
485 
490 M0_INTERNAL int m0_fom_tx_done_wait(struct m0_fom *fom)
491 {
492  struct m0_dtx *dtx = &fom->fo_tx;
493  struct m0_be_tx *tx = m0_fom_tx(fom);
494 
495  if (!fom_is_update(fom))
496  ;
497  else if (dtx->tx_state == M0_DTX_DONE) {
498  if (m0_be_tx_state(tx) == M0_BTS_DONE) {
499  m0_dtx_fini(&fom->fo_tx);
500  return M0_FSO_AGAIN;
501  }
502  m0_fom_wait_on(fom, &tx->t_sm.sm_chan, &fom->fo_cb);
503  return M0_FSO_WAIT;
504  }
505  return M0_FSO_AGAIN;
506 }
507 
520 static int fom_queue_reply(struct m0_fom *fom)
521 {
522  M0_ENTRY("fom=%p req=%p reply=%p local=%d",
523  fom, fom->fo_fop, fom->fo_rep_fop, !!fom->fo_local);
524  if (!fom->fo_local) {
525  M0_PRE(fom->fo_rep_fop != NULL);
526 
527  M0_LOG(M0_DEBUG, "request %p[%u], reply %p, reply->ri_error %d",
528  m0_fop_to_rpc_item(fom->fo_fop),
530  m0_fop_to_rpc_item(fom->fo_rep_fop),
531  m0_fop_to_rpc_item(fom->fo_rep_fop)->ri_error);
532 
534  m0_fop_to_rpc_item(fom->fo_rep_fop));
535  }
536  return M0_FSO_AGAIN;
537 }
538 
543 static int fom_queue_reply_wait(struct m0_fom *fom)
544 {
545  if (fom->fo_tx.tx_state == M0_DTX_INIT) {
547  return M0_FSO_WAIT;
548  }
549 
550  return M0_FSO_AGAIN;
551 }
552 
553 static int fom_timeout(struct m0_fom *fom)
554 {
555  return M0_FSO_AGAIN;
556 }
557 
566 static const struct fom_phase_desc fpd_table[] = {
568  M0_FOPH_AUTHENTICATE, "init",
571  M0_FOPH_RESOURCE_LOCAL, "authen",
574  M0_FOPH_RESOURCE_LOCAL, "authen_wait",
578  "local_resource",
582  "local_resource_wait",
586  "dist_resource",
590  "dist_resource_wait",
593  M0_FOPH_AUTHORISATION, "obj_check",
596  M0_FOPH_AUTHORISATION, "obj_check_wait",
601  "auth_wait",
604  "tx_init", M0_BITS(M0_FOPH_TXN_INIT) },
606  "tx_open", M0_BITS(M0_FOPH_TXN_OPEN) },
608  "tx_wait", M0_BITS(M0_FOPH_TXN_WAIT) },
610  "success", M0_BITS(M0_FOPH_SUCCESS) },
612  "fol_rec_add",
615  "tx_commit",
618  M0_FOPH_QUEUE_REPLY_WAIT, "queue_reply",
622  "queue_reply_wait",
626  "tx_logged_wait",
629  "tx_done_wait",
632  "timeout", M0_BITS(M0_FOPH_TIMEOUT) },
634  "failure", M0_BITS(M0_FOPH_FAILURE) },
635 };
636 
643  [M0_FOPH_INIT] = {
645  .sd_name = "init",
649  },
651  .sd_name = "authen",
652  .sd_allowed = M0_BITS(M0_FOPH_AUTHENTICATE_WAIT,
655  },
657  .sd_name = "authen_wait",
659  },
661  .sd_name = "local_resource",
662  .sd_allowed = M0_BITS(M0_FOPH_RESOURCE_LOCAL_WAIT,
665  },
667  .sd_name = "local_resource_wait",
670  },
672  .sd_name = "dist_resource",
676  },
678  .sd_name = "dist_resource_wait",
680  },
682  .sd_name = "obj_check",
683  .sd_allowed = M0_BITS(M0_FOPH_OBJECT_CHECK_WAIT,
686  },
688  .sd_name = "obj_check_wait",
690  },
692  .sd_name = "auth",
693  .sd_allowed = M0_BITS(M0_FOPH_AUTHORISATION_WAIT,
696  },
698  .sd_name = "auth_wait",
700  },
701  [M0_FOPH_TXN_INIT] = {
702  .sd_name = "tx_init",
704  },
705  [M0_FOPH_TXN_OPEN] = {
706  .sd_name = "tx_open",
707  .sd_allowed = M0_BITS(M0_FOPH_TXN_WAIT)
708  },
709  [M0_FOPH_TXN_WAIT] = {
710  .sd_name = "tx_wait",
711  .sd_allowed = M0_BITS(M0_FOPH_FAILURE,
713  },
714  [M0_FOPH_SUCCESS] = {
715  .sd_name = "success",
716  .sd_allowed = M0_BITS(M0_FOPH_FOL_REC_ADD)
717  },
718  [M0_FOPH_FOL_REC_ADD] = {
719  .sd_name = "fol_rec_add",
720  .sd_allowed = M0_BITS(M0_FOPH_TXN_COMMIT)
721  },
722  [M0_FOPH_TXN_COMMIT] = {
723  .sd_name = "tx_commit",
724  .sd_allowed = M0_BITS(M0_FOPH_QUEUE_REPLY)
725  },
726  [M0_FOPH_QUEUE_REPLY] = {
727  .sd_name = "queue_reply",
728  .sd_allowed = M0_BITS(M0_FOPH_TXN_LOGGED_WAIT,
731  },
733  .sd_name = "queue_reply_wait",
734  .sd_allowed = M0_BITS(M0_FOPH_TXN_LOGGED_WAIT,
736  },
738  .sd_name = "tx_logged_wait",
739  .sd_allowed = M0_BITS(M0_FOPH_TXN_DONE_WAIT)
740  },
742  .sd_name = "tx_done_wait",
743  .sd_allowed = M0_BITS(M0_FOPH_TXN_INIT, M0_FOPH_FINISH)
744  },
745  [M0_FOPH_TIMEOUT] = {
746  .sd_name = "timeout",
747  .sd_allowed = M0_BITS(M0_FOPH_FAILURE)
748  },
749  [M0_FOPH_FAILURE] = {
750  .sd_flags = M0_SDF_FAILURE,
751  .sd_name = "failure",
752  .sd_allowed = M0_BITS(M0_FOPH_FOL_REC_ADD)
753  },
754  [M0_FOPH_FINISH] = {
755  .sd_flags = M0_SDF_TERMINAL,
756  .sd_name = "finish",
757  },
759  .sd_name = "specific-phase",
760  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE,
762  }
763 };
764 
766  {"initialised", M0_FOPH_INIT, M0_FOPH_AUTHENTICATE},
767  {"finished", M0_FOPH_INIT, M0_FOPH_FINISH},
768  {"success", M0_FOPH_INIT, M0_FOPH_SUCCESS},
769  {"init-failed", M0_FOPH_INIT, M0_FOPH_FAILURE},
770  {"start-specific-phases", M0_FOPH_INIT, M0_FOPH_TYPE_SPECIFIC},
771  {"wait-authentication",
773  {"authentication-finished",
775  {"authentication-failed", M0_FOPH_AUTHENTICATE, M0_FOPH_FAILURE},
776  {"authentication-wait-complete",
778  {"authentication-wait-failed",
780  {"local-resource-wait",
782  {"local-resourc-complete",
784  {"local-resource-failed",
786  {"local-resource-wait-complete",
788  {"local-resource-wait-failed",
790  {"distributed-resource-wait",
792  {"distributed-resource-complete",
794  {"distributed-resource-failed",
796  {"distributed-resource-wait-complete",
798  {"distributed-resource-wait-failed",
801  {"object-wait-complete", M0_FOPH_OBJECT_CHECK, M0_FOPH_AUTHORISATION},
802  {"object-failed", M0_FOPH_OBJECT_CHECK, M0_FOPH_FAILURE},
803  {"object-wait-complete",
805  {"object-wait-failed", M0_FOPH_OBJECT_CHECK_WAIT, M0_FOPH_FAILURE},
806  {"authorisation-wait",
808  {"authorisation-complete", M0_FOPH_AUTHORISATION, M0_FOPH_TXN_INIT},
809  {"autorisation-failed", M0_FOPH_AUTHORISATION, M0_FOPH_FAILURE},
810  {"authorisation-wait-complete",
812  {"authorisation-wait-failed",
814  {"tx-initialised", M0_FOPH_TXN_INIT, M0_FOPH_TXN_OPEN},
815  {"tx-initialisation-failed", M0_FOPH_TXN_INIT, M0_FOPH_FAILURE},
816  {"tx-open-wait", M0_FOPH_TXN_OPEN, M0_FOPH_TXN_WAIT},
817  {"tx-open-failed", M0_FOPH_TXN_WAIT, M0_FOPH_FAILURE},
818  {"tx-opened", M0_FOPH_TXN_WAIT, M0_FOPH_TYPE_SPECIFIC},
819  {"completed", M0_FOPH_SUCCESS, M0_FOPH_FOL_REC_ADD},
820  {"fol-record-added", M0_FOPH_FOL_REC_ADD, M0_FOPH_TXN_COMMIT},
821  {"tx-done-start", M0_FOPH_TXN_COMMIT, M0_FOPH_QUEUE_REPLY},
822  {"reply-queue-wait", M0_FOPH_QUEUE_REPLY, M0_FOPH_QUEUE_REPLY_WAIT},
823  {"tx-logged-wait", M0_FOPH_QUEUE_REPLY, M0_FOPH_TXN_LOGGED_WAIT},
824  {"reply-complete", M0_FOPH_QUEUE_REPLY, M0_FOPH_FINISH},
825  {"reply-wait-finished",
827  {"reply-wait-finished", M0_FOPH_QUEUE_REPLY_WAIT, M0_FOPH_FINISH},
828  {"tx-logged-wait-complete", M0_FOPH_TXN_LOGGED_WAIT,
831  {"tx-done-wait-complete", M0_FOPH_TXN_DONE_WAIT, M0_FOPH_FINISH},
832  {"timeout", M0_FOPH_TIMEOUT, M0_FOPH_FAILURE},
834 };
835 
837 
838 const struct m0_sm_conf m0_generic_conf = {
840  .scf_name = "standard-phases",
841  .scf_nr_states = ARRAY_SIZE(generic_phases),
842  .scf_state = generic_phases,
843  .scf_trans_nr = ARRAY_SIZE(m0_generic_phases_trans),
844  .scf_trans = m0_generic_phases_trans,
845 };
846 M0_EXPORTED(m0_generic_conf);
847 
849 {
850  int rc;
851  const struct fom_phase_desc *fpd_phase;
852 
853  M0_PRE(fom != NULL);
854 
855  fpd_phase = &fpd_table[m0_fom_phase(fom)];
856 
857  M0_ENTRY("fom=%p phase=%s", fom,
859 
860  rc = fpd_phase->fpd_action(fom);
861  if (rc < 0) {
863  rc = M0_FSO_AGAIN;
864  } else if (rc == M0_FSO_AGAIN) {
865  /* fpd_action() could change phase */
866  fpd_phase = &fpd_table[m0_fom_phase(fom)];
867  m0_fom_phase_set(fom, fpd_phase->fpd_nextphase);
868  }
869 
871  rc = M0_FSO_WAIT;
872 
873  M0_LEAVE("fom=%p phase=%s rc=%d", fom,
875  return M0_RC(rc);
876 }
877 
879 #undef M0_TRACE_SUBSYSTEM
880 
881 /*
882  * Local variables:
883  * c-indentation-style: "K&R"
884  * c-basic-offset: 8
885  * tab-width: 8
886  * fill-column: 80
887  * scroll-step: 1
888  * End:
889  */
static bool fom_is_update(const struct m0_fom *fom)
Definition: fom_generic.c:100
M0_INTERNAL bool m0_dtm0_is_a_volatile_dtm(struct m0_reqh_service *service)
Definition: service.c:393
uint32_t rit_opcode
Definition: item.h:474
#define M0_PRE(cond)
Definition: dtm.h:554
const struct m0_xcode_type * xf_type
Definition: xcode.h:253
static int fom_obj_check_wait(struct m0_fom *fom)
Definition: fom_generic.c:219
static int fom_timeout(struct m0_fom *fom)
Definition: fom_generic.c:553
#define NULL
Definition: misc.h:38
bool m0_rpc_item_is_generic_reply_fop(const struct m0_rpc_item *item)
Definition: fom_generic.c:75
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
m0_be_tx_state
Definition: tx.h:214
Definition: sm.h:350
M0_INTERNAL void m0_fom_generic_fini(void)
Definition: fom_generic.c:53
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
const struct m0_xcode_type * ft_xt
Definition: fop.h:230
M0_INTERNAL void m0_dtx_init(struct m0_dtx *tx, struct m0_be_domain *be_domain, struct m0_sm_group *sm_group)
Definition: dtm.c:67
const struct m0_be_tx_credit m0_be_tx_credit_invalid
Definition: tx_credit.c:41
M0_INTERNAL void m0_dtx_opened(struct m0_dtx *tx)
Definition: dtm.c:94
static int fom_failure(struct m0_fom *fom)
Definition: fom_generic.c:342
int32_t ri_error
Definition: item.h:161
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
static int fom_loc_resource(struct m0_fom *fom)
Definition: fom_generic.c:175
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
struct m0_xcode_field xct_child[0]
Definition: xcode.h:345
M0_INTERNAL void m0_be_tx_prep(struct m0_be_tx *tx, const struct m0_be_tx_credit *credit)
Definition: stubs.c:175
M0_INTERNAL void m0_fom_wait_on(struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
Definition: fom.c:1490
#define M0_BITS(...)
Definition: misc.h:236
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
M0_ADDB2_ADD(M0_AVI_FS_CREATE, new_fid.f_container, new_fid.f_key, mode, rc)
static int fom_auth(struct m0_fom *fom)
Definition: fom_generic.c:229
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
static struct m0_rpc_item * item
Definition: item.c:56
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
m0_fom_phase
Definition: fom.h:372
static struct m0_be_tx * m0_fom_tx(struct m0_fom *fom)
Definition: fom.h:537
static int fom_queue_reply(struct m0_fom *fom)
Definition: fom_generic.c:520
static int fom_success(struct m0_fom *fom)
Definition: fom_generic.c:399
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
static int fom_fol_rec_add(struct m0_fom *fom)
Definition: fom_generic.c:407
int32_t m0_rpc_item_generic_reply_rc(const struct m0_rpc_item *reply)
Definition: fom_generic.c:81
int opcode
Definition: crate.c:301
struct m0_fop_type * f_type
Definition: fop.h:81
static int fom_authen_wait(struct m0_fom *fom)
Definition: fom_generic.c:166
uint64_t fpd_pre_phase
Definition: fom_generic.c:137
const char * name
Definition: trace.c:110
M0_INTERNAL int m0_fop_fol_add(struct m0_fop *fop, struct m0_fop *rep, struct m0_dtx *dtx)
Definition: fop.c:427
M0_INTERNAL void m0_dtx_open(struct m0_dtx *tx)
Definition: dtm.c:86
int m0_fom_tick_generic(struct m0_fom *fom)
Definition: fom_generic.c:848
#define M0_ASSERT(cond)
void m0_fom_phase_move(struct m0_fom *fom, int32_t rc, int phase)
Definition: fom.c:1699
static struct m0_fop reply_fop
Definition: fsync.c:64
M0_INTERNAL void m0_fom_fdmi_record_post(struct m0_fom *fom)
Definition: fom.c:1742
static int fom_tx_commit(struct m0_fom *fom)
Definition: fom_generic.c:441
M0_INTERNAL void m0_fom_mod_rep_fill(struct m0_fop_mod_rep *rep, struct m0_fom *fom)
Definition: fom_generic.c:68
const struct m0_rpc_item_type * ri_type
Definition: item.h:200
M0_INTERNAL int m0_fom_tx_done_wait(struct m0_fom *fom)
Definition: fom_generic.c:490
M0_INTERNAL int m0_fom_generic_init(void)
Definition: fom_generic.c:58
M0_INTERNAL void m0_dtx_fini(struct m0_dtx *tx)
Definition: dtm.c:134
int(* fpd_action)(struct m0_fom *fom)
Definition: fom_generic.c:120
int32_t sm_rc
Definition: sm.h:336
Definition: dump.c:103
M0_INTERNAL bool m0_rpc_item_is_update(const struct m0_rpc_item *item)
Definition: item.c:504
static int fom_tx_open(struct m0_fom *fom)
Definition: fom_generic.c:268
void m0_rpc_reply_post(struct m0_rpc_item *request, struct m0_rpc_item *reply)
Definition: rpc.c:135
static int fom_phase_init(struct m0_fom *fom)
Definition: fom_generic.c:148
static int fom_dist_resource(struct m0_fom *fom)
Definition: fom_generic.c:192
M0_INTERNAL void m0_be_tx_get(struct m0_be_tx *tx)
Definition: stubs.c:167
uint64_t t_id
Definition: tx.h:284
M0_INTERNAL void m0_dtx_done(struct m0_dtx *tx)
Definition: dtm.c:115
struct m0_sm t_sm
Definition: tx.h:281
uint64_t scf_magic
Definition: sm.h:351
struct m0_fop_type m0_fop_generic_reply_fopt
Definition: fom_generic.c:50
struct m0_fop * m0_fop_reply_alloc(struct m0_fop *req, struct m0_fop_type *rept)
Definition: fop.c:129
static int fom_loc_resource_wait(struct m0_fom *fom)
Definition: fom_generic.c:184
uint32_t sd_flags
Definition: sm.h:378
Definition: fom.h:481
static int fom_auth_wait(struct m0_fom *fom)
Definition: fom_generic.c:238
const struct m0_xcode_type M0_XT_U32
Definition: xcode.c:932
static void generic_reply_build(struct m0_fom *fom)
Definition: fom_generic.c:318
M0_BASSERT(ARRAY_SIZE(m0_generic_phases_trans)==M0_FOM_GENERIC_TRANS_NR)
static int fom_authen(struct m0_fom *fom)
Definition: fom_generic.c:157
const char * fpd_name
Definition: fom_generic.c:129
struct m0_be_tx tx_betx
Definition: dtm.h:559
struct m0_chan sm_chan
Definition: sm.h:331
static int fom_tx_wait(struct m0_fom *fom)
Definition: fom_generic.c:289
M0_INTERNAL void m0_be_tx_open(struct m0_be_tx *tx)
Definition: stubs.c:184
M0_INTERNAL int m0_fom_rc(const struct m0_fom *fom)
Definition: fom.c:1727
struct m0_rpc_item * m0_fop_to_rpc_item(const struct m0_fop *fop)
Definition: fop.c:338
struct m0_sm_trans_descr m0_generic_phases_trans[]
Definition: fom_generic.c:765
enum m0_dtx_state tx_state
Definition: dtm.h:558
static struct m0_sm_state_descr generic_phases[]
Definition: fom_generic.c:642
static int fom_queue_reply_wait(struct m0_fom *fom)
Definition: fom_generic.c:543
struct m0_rpc_item_type ft_rpc_item_type
Definition: fop.h:235
M0_INTERNAL void m0_be_tx_put(struct m0_be_tx *tx)
Definition: stubs.c:171
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
Definition: fop.c:346
static int fom_tx_init(struct m0_fom *fom)
Definition: fom_generic.c:248
static const struct fom_phase_desc fpd_table[]
Definition: fom_generic.c:566
M0_INTERNAL int m0_fom_fol_rec_add(struct m0_fom *fom)
Definition: fom.c:1737
#define M0_ASSERT_INFO(cond, fmt,...)
static int fom_dist_resource_wait(struct m0_fom *fom)
Definition: fom_generic.c:201
M0_INTERNAL int m0_fom_tx_logged_wait(struct m0_fom *fom)
Definition: fom_generic.c:461
M0_INTERNAL void m0_be_tx_payload_prep(struct m0_be_tx *tx, m0_bcount_t size)
Definition: stubs.c:180
void m0_fom_phase_set(struct m0_fom *fom, int phase)
Definition: fom.c:1688
static struct m0_dtm_oper_descr reply
Definition: transmit.c:94
M0_INTERNAL uint64_t m0_sm_id_get(const struct m0_sm *sm)
Definition: sm.c:1021
static int fom_obj_check(struct m0_fom *fom)
Definition: fom_generic.c:210
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
Definition: fop.h:79
M0_INTERNAL struct m0_reqh * m0_fom_reqh(const struct m0_fom *fom)
Definition: fom.c:283
Definition: tx.h:280
M0_INTERNAL const char * m0_fom_phase_name(const struct m0_fom *fom, int phase)
Definition: fom.c:1722