Motr  M0
plugin_dock.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-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_FDMI
24 
25 #include "lib/trace.h"
26 #include "motr/magic.h" /* M0_CONFC_MAGIC, M0_CONFC_CTX_MAGIC */
27 #include "rpc/rpc.h" /* m0_rpc_post */
28 #include "rpc/rpclib.h" /* m0_rpc_client_connect */
29 #include "lib/arith.h" /* M0_CNT_INC, M0_CNT_DEC */
30 #include "lib/misc.h" /* M0_IN */
31 #include "lib/errno.h" /* ENOMEM, EPROTO */
32 #include "lib/memory.h" /* M0_ALLOC_ARR, m0_free */
33 #include "lib/finject.h" /* M0_FI_ENABLED */
34 #include "net/lnet/lnet.h" /* M0_NET_LNET_XEP_ADDR_LEN */
35 #include "fop/fop.h"
36 #include "fop/fop_item_type.h"
37 #include "fop/fom_generic.h"
38 #include "rpc/rpc_opcodes.h"
39 #include "fdmi/fdmi.h"
40 #include "fdmi/plugin_dock.h"
42 #include "fdmi/fops.h" /* m0_fop_fdmi_record */
43 #include "fdmi/fops_xc.h"
44 #include "rpc/conn_pool.h"
45 #include "fdmi/module.h"
46 
47 M0_TL_DESCR_DEFINE(fdmi_filters, "filter regs list", static,
48  struct m0_fdmi_filter_reg, ffr_link, ffr_magic,
50 M0_TL_DEFINE(fdmi_filters, static, struct m0_fdmi_filter_reg);
51 
52 M0_TL_DESCR_DEFINE(fdmi_recs, "fdmi record regs list", static,
53  struct m0_fdmi_record_reg, frr_link, frr_magic,
55 M0_TL_DEFINE(fdmi_recs, static, struct m0_fdmi_record_reg);
56 
57 M0_INTERNAL struct m0_rpc_conn_pool *ut_pdock_conn_pool(void)
58 {
60  return &m->fdm_p.fdmp_conn_pool;
61 }
62 
65 
66 static void pdock_record_release(struct m0_ref *ref);
67 
68 static int pdock_client_post(struct m0_fop *fop,
69  struct m0_rpc_session *session,
70  const struct m0_rpc_item_ops *ri_ops);
71 
72 #if 0 /* cut off until future development */
73 #define SERVER_ENDPOINT_ADDR "0@lo:12345:34:1"
74 #define SERVER_ENDPOINT "lnet:" SERVER_ENDPOINT_ADDR
75 
76 
77 static void plugin_dock_fopts_init(void)
78 {
80  .name = "plugin dock fdmi filters enable",
82  .xt = m0_fdmi_filters_enable_xc,
83  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST,
84  .sm = &m0_generic_conf,
85  );
86 
88  .name = "plugin dock fdmi filters enable reply",
90  .xt = m0_fdmi_filters_enable_reply_xc,
91  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY,
92  .sm = &m0_generic_conf,
93  );
94 }
95 #endif
96 
98 {
100  return m->fdm_p.fdmp_conn_pool.cp_rpc_mach;
101 }
102 
103 static void test_print_fdmi_rec_list(void)
104 {
106  struct m0_fdmi_record_reg *rreg;
107 
108  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
109  m0_tl_for(fdmi_recs, &m->fdm_p.fdmp_fdmi_recs, rreg) {
110  M0_ENTRY("DBG: rreg: %p, rid: " U128X_F,
111  rreg, U128_P(&rreg->frr_rec->fr_rec_id));
112  } m0_tl_endfor;
113  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
114 }
115 
116 
117 struct
119 {
121  struct m0_fdmi_filter_reg *reg;
122 
123  M0_ENTRY();
124 
125  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_filters_lock);
126  reg = m0_tl_find(fdmi_filters, freg, &m->fdm_p.fdmp_fdmi_filters,
127  m0_fid_eq(fid, &freg->ffr_ffid));
128  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_filters_lock);
129 
130  M0_LEAVE();
131  return reg;
132 }
133 
134 struct
136 {
138  struct m0_fdmi_record_reg *reg;
139 
140  M0_ENTRY("rid " U128X_F, U128_P(rid));
141 
142  if (M0_FI_ENABLED("fail_find"))
143  return NULL;
144 
145  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
146  reg = m0_tl_find(fdmi_recs, rreg, &m->fdm_p.fdmp_fdmi_recs,
147  m0_uint128_eq( rid, &rreg->frr_rec->fr_rec_id ));
148  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
149 
150  M0_LEAVE("<< reg %p", reg);
151  return reg;
152 }
153 
159 static int register_filter(const struct m0_fid *fid,
160  const struct m0_fdmi_filter_desc *desc,
161  const struct m0_fdmi_plugin_ops *pcb)
162 {
164  struct m0_fdmi_plugin_ops *pcb_copy;
165  struct m0_fdmi_filter_desc *desc_copy;
166  struct m0_fdmi_filter_reg *filter;
167  int rc;
168 
169  M0_ENTRY();
170 
171  if (desc == NULL || pcb == NULL)
172  return M0_RC(-EINVAL);
173 
174  M0_ALLOC_PTR(pcb_copy);
175  if (pcb_copy == NULL)
176  return M0_RC(-ENOMEM);
177  else
178  *pcb_copy = *pcb;
179 
180  M0_ALLOC_PTR(desc_copy);
181  if (desc_copy == NULL)
182  {
183  rc = -ENOMEM;
184  goto free_pcb;
185  }
186  else
187  *desc_copy = *desc;
188 
190  if (filter == NULL) {
191  rc = -ENOMEM;
192  goto free_desc;
193  } else {
194  *filter = (struct m0_fdmi_filter_reg) {
195  .ffr_ffid = *fid,
196  .ffr_desc = desc_copy,
197  .ffr_pcb = pcb_copy,
198 #if 0 /* cut off until future development */
199  /*
200  * FIXME: we need to get the endpoint at runtime
201  * but not statically defined one (phase 2)
202  */
203  .ffr_ep = SERVER_ENDPOINT,
204 #endif
205  .ffr_flags = M0_BITS(M0_FDMI_FILTER_INACTIVE),
206  .ffr_magic = M0_FDMI_FLTR_MAGIC
207  };
208 
209  }
210 
211  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_filters_lock);
212  fdmi_filters_tlink_init_at_tail(filter, &m->fdm_p.fdmp_fdmi_filters);
213  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_filters_lock);
214 
215  return M0_RC(0);
216 
217 free_desc:
218  m0_free(desc_copy);
219 free_pcb:
220  m0_free(pcb_copy);
221 
222  return M0_RC(rc);
223 }
224 
230 static void enable_filters(bool enable,
231  struct m0_fid *filter_ids,
232  uint32_t filter_count)
233 {
234  struct m0_fdmi_filter_reg *reg;
235  uint32_t idx;
236 
237  M0_ENTRY();
238 
239  /* put local mark */
240  for (idx = 0; idx < filter_count; ++idx) {
241  reg = m0_fdmi__pdock_filter_reg_find(&filter_ids[idx]);
242  if (reg != NULL) {
243  M0_ASSERT(m0_fid_eq(&reg->ffr_ffid, &filter_ids[idx]));
244 
245  enable ? ({ reg->ffr_flags &= ~M0_BITS(
248  : ({ reg->ffr_flags |= M0_BITS(
250  ); });
251  } else {
253  "filter reg not found: ffid = "FID_SF,
254  FID_P(&filter_ids[idx]));
255  }
256  }
257 
260  M0_LEAVE();
261 }
262 
264  bool replied)
265 {
267  struct m0_fop *fop;
268  struct m0_fop_fdmi_rec_release *rdata;
269  struct m0_fdmi_record_reg *rreg;
270 
271  M0_ENTRY("item = %p, replied = %i", item, replied);
272 
274  rdata = m0_fop_data(fop);
275 
276  if (replied) {
278  "`release fdmi record` successfully replied: id = "
279  U128X_F, U128_P(&rdata->frr_frid));
280  } else {
282  "`release fdmi record` was not replied: id = "
283  U128X_F, U128_P(&rdata->frr_frid));
284  }
285 
287  if (rreg != NULL) {
288  M0_LOG(M0_DEBUG, "remove and free rreg %p, rid " U128X_F,
289  rreg, U128_P(&rreg->frr_rec->fr_rec_id));
290  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
291  fdmi_recs_tlist_remove(rreg);
292  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
293 
294  if (rreg->frr_sess != NULL)
295  m0_rpc_conn_pool_put(&m->fdm_p.fdmp_conn_pool,
296  rreg->frr_sess);
297 
298  if (rreg->frr_ep_addr != NULL)
299  m0_free(rreg->frr_ep_addr);
300 
301  m0_fop_put(rreg->frr_fop);
302  m0_free(rreg);
303  } else {
305  "fdmi record was not found in pdock: id = "U128X_F,
306  U128_P(&rdata->frr_frid));
307  }
308 
309  M0_LEAVE();
310 }
311 
312 static void release_replied(struct m0_rpc_item *item)
313 {
314  M0_ENTRY("item %p, ri_error 0x%x", item, item->ri_error);
315 
316  /* FIXME: Can be refactored (phase 2) */
317  pdock_record_reg_cleanup(item, (bool)(item->ri_error == 0));
318  M0_LEAVE();
319 }
320 
323 };
324 
330 static void release_fdmi_rec(struct m0_uint128 *rec_id,
331  struct m0_fid *filter_id M0_UNUSED)
332 {
333  struct m0_fdmi_record_reg *rreg;
334 
335  M0_ENTRY();
336 
337  rreg = m0_fdmi__pdock_record_reg_find(rec_id);
338  if (rreg == NULL) {
339  M0_LOG(M0_NOTICE, "FDMI record not listed: id = "
340  U128X_F, U128_P(rec_id));
341  goto leave;
342  }
343 
344  m0_ref_put(&rreg->frr_ref); /* pdock_record_release() is gonna be
345  * called when refc gets to zero
346  */
347 leave:
348  M0_LEAVE();
349 }
350 
351 
352 M0_INTERNAL struct
354 {
356  struct m0_fop_fdmi_record *frec;
357  struct m0_fdmi_record_reg *rreg;
358 
359  M0_ENTRY();
360  M0_ASSERT(m->fdm_p.fdmp_dock_inited);
361 
362  if (M0_FI_ENABLED("fail_fdmi_rec_reg"))
363  return NULL;
364 
365  frec = m0_fop_data(fop);
366 
367  /* prepare record registration entry */
368 
369  M0_ALLOC_PTR(rreg);
370  if (rreg == NULL) {
371  M0_LOG(M0_ERROR, "No memory available");
372  goto leave;
373  }
374 
375  rreg->frr_rec = frec; /* attaching fop payload to reg entry */
376  rreg->frr_fop = fop;
377  m0_fop_get(rreg->frr_fop); /* This ref will be released when
378  * "FDMI release request" is sent
379  * and replied. Please see functions
380  * release_replied() and
381  * pdock_record_reg_cleanup() for
382  * more details.
383  */
384 
385  if (m0_fop_to_rpc_item(fop)->ri_rmachine != NULL) { /* the test is for
386  * the sake of ut,
387  * when no rpc
388  * appears being
389  * in use */
390  const char *ep_addr =
392 
393  M0_LOG(M0_DEBUG, "FOP remote endpoint address = %s", ep_addr);
394 
395  rreg->frr_ep_addr = m0_strdup(ep_addr);
396  }
397 
398  /* lock the record until fom is done with the one */
400 
401  /* keep registration entry */
402  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
403  fdmi_recs_tlink_init_at_tail(rreg, &m->fdm_p.fdmp_fdmi_recs);
404  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
405 
407 
408  M0_LOG(M0_DEBUG, "add to list rreg %p, rid " U128X_F " refcnt=%d",
409  rreg, U128_P(&rreg->frr_rec->fr_rec_id),
410  (int)m0_ref_read(&rreg->frr_ref));
411 
412 leave:
413  M0_LEAVE();
414  return rreg;
415 }
416 
420 static void pdock_record_release(struct m0_ref *ref)
421 {
423  struct m0_fdmi_record_reg *rreg;
424  struct m0_fop *req;
425  struct m0_fop_fdmi_rec_release *req_data;
426  int rc;
427 
428  M0_ENTRY();
429 
430  req = NULL;
431  req_data = NULL;
432  rc = 0;
433 
434  rreg = container_of(ref, struct m0_fdmi_record_reg, frr_ref);
435 
436  M0_LOG(M0_DEBUG, "Will send release for rreg %p, rid " U128X_F,
437  rreg, U128_P(&rreg->frr_rec->fr_rec_id));
438 
439  if (rreg->frr_ep_addr == NULL) {
440  /* No way to post anything over RPC */
441  rc = -EACCES;
442  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
443  fdmi_recs_tlist_remove(rreg);
444  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
445  if (rreg->frr_sess != NULL)
446  m0_rpc_conn_pool_put(&m->fdm_p.fdmp_conn_pool,
447  rreg->frr_sess);
448  m0_free(rreg);
449 
450  goto leave;
451  }
452 
453  /* Post release request */
454 
455  M0_ALLOC_PTR(req_data);
456  if (req_data == NULL) {
457  M0_LOG(M0_ERROR, "request data allocation failed");
458  M0_RC(-ENOMEM);
459  return;
460  }
461 
462  req_data->frr_frt = rreg->frr_rec->fr_rec_type;
463  req_data->frr_frid = rreg->frr_rec->fr_rec_id;
464 
467  if (req == NULL) {
468  m0_free(req_data);
469  M0_LOG(M0_ERROR, "fop allocation failed");
470  rc = -ENOMEM;
471  goto leave;
472  }
473 
474  /* @todo Possibly blocks here for a long time (phase 2) */
475  rc = m0_rpc_conn_pool_get_sync(&m->fdm_p.fdmp_conn_pool,
476  rreg->frr_ep_addr, &rreg->frr_sess);
477 
478  if (rc != 0) {
479  rc = -ENOENT;
481  "RPC failed to get connection to post release request: "
482  "id = " U128X_F, U128_P(&req_data->frr_frid));
483  goto leave;
484  }
485 
486  /* FIXME: TEMP */
487  M0_LOG(M0_DEBUG, "Processed FDMI rec "U128X_F". Releasing it now.",
488  U128_P(&rreg->frr_rec->fr_rec_id));
489 
491  if (rc != 0) {
493  "RPC failed to post release request: id = "
494  U128X_F", rc = %d",
495  U128_P(&req_data->frr_frid), rc);
496  if (rreg->frr_sess != NULL) {
497  m0_rpc_conn_pool_put(&m->fdm_p.fdmp_conn_pool,
498  rreg->frr_sess);
499  }
500  }
501 
502 leave:
503  if (req != NULL) {
504  if (m0_fop_to_rpc_item(req)->ri_rmachine != NULL &&
505  rreg->frr_sess != NULL)
507  else
508  m0_free(req);
509  }
510 
511  M0_RC(rc);
512 }
513 
519 static void deregister_plugin(struct m0_fid *filter_ids,
520  uint64_t filter_count)
521 {
523  struct m0_fdmi_filter_reg *freg;
524  int idx;
525 
526  M0_ENTRY();
527 
528  /* deactivate filters */
529  enable_filters(false, filter_ids, filter_count);
530 
531  /* kill their registrations */
532  for (idx = 0; idx < filter_count; idx++) {
533  freg = m0_fdmi__pdock_filter_reg_find(&filter_ids[idx]);
534 
535  if (freg == NULL) {
537  "Filter reg not found: id = "FID_SF,
538  FID_P(&filter_ids[idx]));
539  continue;
540  }
541 
542  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_filters_lock);
543  fdmi_filters_tlist_remove(freg);
544  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_filters_lock);
545  m0_free(freg->ffr_desc);
546  m0_free(freg->ffr_pcb);
547 #if 0
548  m0_free(freg->ffr_ep);
549 #endif
550  m0_free(freg);
551  }
552 
553  M0_LEAVE();
554 }
555 
556 const struct m0_fdmi_pd_ops fdmi_pdo = {
558  .fpo_enable_filters = enable_filters,
559  .fpo_release_fdmi_rec = release_fdmi_rec,
560  .fpo_deregister_plugin = deregister_plugin
561 };
562 
564 {
565  return &fdmi_pdo;
566 }
567 
568 M0_INTERNAL int m0_fdmi__plugin_dock_init(void)
569 {
571  M0_ENTRY();
572 
573  if (m->fdm_p.fdmp_dock_inited) {
574  M0_LOG(M0_WARN, "Plugin dock is already initialized.");
575  return M0_RC(0);
576  }
577 
578  /* Disabled until future development */
579 #if 0
580  /* Prepare RPC receiving */
581  plugin_dock_fopts_init();
582 #endif
583  /* Initialise communication context. */
584  fdmi_filters_tlist_init(&m->fdm_p.fdmp_fdmi_filters);
585  m0_mutex_init(&m->fdm_p.fdmp_fdmi_filters_lock);
586  fdmi_recs_tlist_init(&m->fdm_p.fdmp_fdmi_recs);
587  m0_mutex_init(&m->fdm_p.fdmp_fdmi_recs_lock);
588  m->fdm_p.fdmp_dock_inited = true;
589  return M0_RC(0);
590 }
591 
592 M0_INTERNAL int m0_fdmi__plugin_dock_start(struct m0_reqh *reqh)
593 {
595  struct m0_rpc_machine *rpc_machine;
596  int rc;
597 
598  M0_ENTRY();
599 
600  M0_ASSERT(m->fdm_p.fdmp_dock_inited);
601  rpc_machine = m0_reqh_rpc_mach_tlist_head(&reqh->rh_rpc_machines);
602 
603  M0_SET0(&m->fdm_p.fdmp_conn_pool);
604  rc = m0_rpc_conn_pool_init(&m->fdm_p.fdmp_conn_pool, rpc_machine,
605  M0_TIME_NEVER, /* connection timeout*/
606  32 /* max rpcs in flight */);
607 
608  return M0_RC(rc);
609 }
610 
611 M0_INTERNAL void m0_fdmi__plugin_dock_stop()
612 {
614  M0_ENTRY();
615  m0_rpc_conn_pool_fini(&m->fdm_p.fdmp_conn_pool);
616  M0_LEAVE();
617 }
618 
619 M0_INTERNAL void m0_fdmi__plugin_dock_fini(void)
620 {
622  struct m0_fdmi_record_reg *rreg;
623  struct m0_fdmi_filter_reg *freg;
624 
625  M0_ENTRY();
626 
627  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_recs_lock);
628  m0_tl_teardown(fdmi_recs, &m->fdm_p.fdmp_fdmi_recs, rreg) {
629  /* @todo Find out what to do with frr_rec (phase 2). */
630  M0_LOG(M0_DEBUG, "teardown: remove and free rreg %p, rid "
631  U128X_F, rreg, U128_P(&rreg->frr_rec->fr_rec_id));
632  if (rreg->frr_ep_addr != NULL)
633  m0_free(rreg->frr_ep_addr);
634  m0_free(rreg);
635  }
636  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_recs_lock);
637 
638  m0_mutex_lock(&m->fdm_p.fdmp_fdmi_filters_lock);
639  m0_tl_teardown(fdmi_filters, &m->fdm_p.fdmp_fdmi_filters, freg) {
640  m0_free(freg->ffr_desc);
641  m0_free(freg->ffr_pcb);
642 #if 0
643  m0_free(freg->ffr_ep);
644 #endif
645  m0_free(freg);
646  }
647  m0_mutex_unlock(&m->fdm_p.fdmp_fdmi_filters_lock);
648 
651  m->fdm_p.fdmp_dock_inited = false;
652 
653  fdmi_filters_tlist_fini(&m->fdm_p.fdmp_fdmi_filters);
654  m0_mutex_fini(&m->fdm_p.fdmp_fdmi_filters_lock);
655 
656  fdmi_recs_tlist_fini(&m->fdm_p.fdmp_fdmi_recs);
657  m0_mutex_fini(&m->fdm_p.fdmp_fdmi_recs_lock);
658 
659  M0_LEAVE();
660 }
661 
662 static int pdock_client_post(struct m0_fop *fop,
663  struct m0_rpc_session *session,
664  const struct m0_rpc_item_ops *ri_ops)
665 {
666  int rc;
667  struct m0_rpc_item *item;
668 
669  M0_ENTRY("fop: %p, session: %p", fop, session);
670 
671  item = &fop->f_item;
672  item->ri_ops = ri_ops;
677  item->ri_nr_sent_max = ~(uint64_t)0;
678 
679  rc = m0_rpc_post(item);
680 
681  return M0_RC(rc);
682 }
683 
684 #undef M0_TRACE_SUBSYSTEM
685 
686 /*
687  * Local variables:
688  * c-indentation-style: "K&R"
689  * c-basic-offset: 8
690  * tab-width: 8
691  * fill-column: 80
692  * scroll-step: 1
693  * End:
694  */
695 /*
696  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
697  */
M0_INTERNAL int m0_rpc_post(struct m0_rpc_item *item)
Definition: rpc.c:63
m0_time_t ri_resend_interval
Definition: item.h:144
const struct m0_fdmi_pd_ops fdmi_pdo
Definition: plugin_dock.c:556
#define FID_SF
Definition: fid.h:76
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
static void pdock_record_reg_cleanup(struct m0_rpc_item *item, bool replied)
Definition: plugin_dock.c:263
#define m0_strdup(s)
Definition: string.h:43
enum m0_rpc_item_priority ri_prio
Definition: item.h:133
struct m0_rpc_machine * m0_fdmi__pdock_conn_pool_rpc_machine()
Definition: plugin_dock.c:97
M0_INTERNAL void m0_rpc_conn_pool_fini(struct m0_rpc_conn_pool *pool)
Definition: conn_pool.c:345
#define NULL
Definition: misc.h:38
static struct m0_addb2_mach * m
Definition: consumer.c:38
M0_INTERNAL void m0_fdmi__plugin_dock_stop()
Definition: plugin_dock.c:611
static const char * ep_addr
Definition: rpc_machine.c:35
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
static struct io_request req
Definition: file.c:100
M0_INTERNAL bool m0_uint128_eq(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
Definition: misc.c:39
struct m0_fdmi_record_reg * m0_fdmi__pdock_record_reg_find(const struct m0_uint128 *rid)
Definition: plugin_dock.c:135
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
static void deregister_plugin(struct m0_fid *filter_ids, uint64_t filter_count)
Definition: plugin_dock.c:519
M0_INTERNAL int m0_rpc_conn_pool_init(struct m0_rpc_conn_pool *pool, struct m0_rpc_machine *rpc_mach, m0_time_t conn_timeout, uint64_t max_rpcs_in_flight)
Definition: conn_pool.c:325
static void enable_filters(bool enable, struct m0_fid *filter_ids, uint32_t filter_count)
Definition: plugin_dock.c:230
static void leave(struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
Definition: locality.c:315
struct m0_fid ffr_ffid
Definition: plugin_dock.h:80
M0_INTERNAL struct m0_fdmi_record_reg * m0_fdmi__pdock_fdmi_record_register(struct m0_fop *fop)
Definition: plugin_dock.c:353
struct m0_fdmi_plugin_ops * ffr_pcb
Definition: plugin_dock.h:84
int32_t ri_error
Definition: item.h:161
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
#define M0_BITS(...)
Definition: misc.h:236
m0_fdmi_rec_type_id_t frr_frt
Definition: fops.h:95
M0_INTERNAL struct m0_fdmi_module * m0_fdmi_module__get(void)
Definition: module.c:51
#define container_of(ptr, type, member)
Definition: misc.h:33
static struct m0_rpc_session session
Definition: formation2.c:38
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
m0_time_t m0_time(uint64_t secs, long ns)
Definition: time.c:41
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
static struct m0_rpc_item * item
Definition: item.c:56
uint32_t ffr_flags
Definition: plugin_dock.h:91
static void release_fdmi_rec(struct m0_uint128 *rec_id, struct m0_fid *filter_id M0_UNUSED)
Definition: plugin_dock.c:330
#define m0_tl_endfor
Definition: tlist.h:700
struct m0_fid fid
Definition: di.c:46
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
Definition: filter.py:1
int opcode
Definition: crate.c:301
static struct m0_rm_incoming_ops ri_ops
Definition: wlock_helper.c:71
M0_INTERNAL void m0_ref_put(struct m0_ref *ref)
Definition: refs.c:38
struct m0_uint128 frr_frid
Definition: fops.h:94
void m0_ref_init(struct m0_ref *ref, int init_num, void(*release)(struct m0_ref *ref))
Definition: refs.c:24
const char * name
Definition: trace.c:110
Definition: refs.h:34
#define m0_tl_teardown(name, head, obj)
Definition: tlist.h:708
M0_INTERNAL struct m0_rpc_conn_pool * ut_pdock_conn_pool(void)
Definition: plugin_dock.c:57
#define M0_ASSERT(cond)
struct m0_fop * frr_fop
Definition: plugin_dock.h:114
#define U128_P(x)
Definition: types.h:45
M0_INTERNAL int m0_fdmi__plugin_dock_init(void)
Definition: plugin_dock.c:568
struct m0_tl rh_rpc_machines
Definition: reqh.h:135
struct m0_fop_type m0_fop_fdmi_rec_release_fopt
Definition: fops.c:49
struct m0_fop * m0_fop_get(struct m0_fop *fop)
Definition: fop.c:162
uint32_t fr_rec_type
Definition: fops.h:72
M0_TL_DESCR_DEFINE(fdmi_filters, "filter regs list", static, struct m0_fdmi_filter_reg, ffr_link, ffr_magic, M0_FDMI_FLTR_MAGIC, M0_FDMI_FLTR_HEAD_MAGIC)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
uint64_t ri_nr_sent_max
Definition: item.h:146
static void release_replied(struct m0_rpc_item *item)
Definition: plugin_dock.c:312
#define SERVER_ENDPOINT
Definition: common.h:31
Definition: reqh.h:94
static int register_filter(const struct m0_fid *fid, const struct m0_fdmi_filter_desc *desc, const struct m0_fdmi_plugin_ops *pcb)
Definition: plugin_dock.c:159
static void test_print_fdmi_rec_list(void)
Definition: plugin_dock.c:103
#define FID_P(f)
Definition: fid.h:77
#define U128X_F
Definition: types.h:42
void(* rio_replied)(struct m0_rpc_item *item)
Definition: item.h:300
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:164
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
Definition: refs.c:44
struct m0_reqh reqh
Definition: rm_foms.c:48
M0_TL_DEFINE(fdmi_filters, static, struct m0_fdmi_filter_reg)
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
const struct m0_rpc_item_ops * ri_ops
Definition: item.h:149
struct m0_rpc_item_ops release_ri_ops
Definition: plugin_dock.c:321
struct m0_rpc_session * ri_session
Definition: item.h:147
int(* fpo_register_filter)(const struct m0_fid *fid, const struct m0_fdmi_filter_desc *desc, const struct m0_fdmi_plugin_ops *pcb)
Definition: plugin_dock.h:131
struct m0_rpc_item * m0_fop_to_rpc_item(const struct m0_fop *fop)
Definition: fop.c:338
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
void m0_fop_put_lock(struct m0_fop *fop)
Definition: fop.c:199
static struct m0_fop * fop
Definition: item.c:57
struct m0_fdmi_filter_reg * m0_fdmi__pdock_filter_reg_find(const struct m0_fid *fid)
Definition: plugin_dock.c:118
struct m0_uint128 fr_rec_id
Definition: fops.h:69
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
Definition: fop.c:346
struct m0_rpc_session * frr_sess
Definition: plugin_dock.h:110
struct m0_ref frr_ref
Definition: plugin_dock.h:112
static void pdock_record_release(struct m0_ref *ref)
Definition: plugin_dock.c:420
M0_INTERNAL int m0_rpc_conn_pool_get_sync(struct m0_rpc_conn_pool *pool, const char *remote_ep, struct m0_rpc_session **session)
Definition: conn_pool.c:197
M0_INTERNAL int m0_fdmi__plugin_dock_start(struct m0_reqh *reqh)
Definition: plugin_dock.c:592
def filter(argv)
Definition: filter.py:27
struct m0_fdmi_filter_desc * ffr_desc
Definition: plugin_dock.h:82
struct m0_fop_fdmi_record * frr_rec
Definition: plugin_dock.h:103
M0_INTERNAL void m0_fdmi__plugin_dock_fini(void)
Definition: plugin_dock.c:619
#define m0_tl_find(name, var, head,...)
Definition: tlist.h:757
#define m0_tl_for(name, head, obj)
Definition: tlist.h:695
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
static struct m0_rpc_machine rpc_machine
Definition: service_ut.c:63
int32_t rc
Definition: trigger_fop.h:47
struct m0_fop_type m0_pdock_fdmi_filters_enable_rep_fopt
Definition: plugin_dock.c:64
static int pdock_client_post(struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops)
Definition: plugin_dock.c:662
const m0_time_t M0_TIME_IMMEDIATELY
Definition: time.c:107
Definition: fop.h:79
Definition: trace.h:478
struct m0_fop_type m0_pdock_fdmi_filters_enable_fopt
Definition: plugin_dock.c:63
M0_INTERNAL const char * m0_rpc_item_remote_ep_addr(const struct m0_rpc_item *item)
Definition: item.c:1188
m0_time_t ri_deadline
Definition: item.h:141
M0_INTERNAL void m0_rpc_conn_pool_put(struct m0_rpc_conn_pool *pool, struct m0_rpc_session *session)
Definition: conn_pool.c:288
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
Definition: fop.c:96
#define M0_UNUSED
Definition: misc.h:380
const struct m0_fdmi_pd_ops * m0_fdmi_plugin_dock_api_get(void)
Definition: plugin_dock.c:563