Motr  M0
fsync.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-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 #include <linux/version.h> /* LINUX_VERSION_CODE */
24 
25 /*
26  * Production code : m0t1fs/linux_kernel/f{ile,sync}.c
27  * UT code : m0t1fs/linux_kernel/ut/fsync.c
28  *
29  * The production code is added this way to build motr kernel module.
30  * Both production code and UT code are part of Motr kernel module
31  * but production code file is not directly added to Makefile as a file
32  * that needs to be compiled.
33  * Instead, UT code is added in Makefile for motr kernel module build
34  * which subsequently adds production code file to motr kernel module.
35  */
36 #include <linux/version.h>
37 #include "ut/ut.h" /* m0_test_suite */
38 #include "lib/tlist.h"
39 #include "lib/hash.h"
40 #include "lib/trace.h"
41 #include "mdservice/fsync_fops.h" /* m0_fop_fsync_mds_fopt */
42 #include "m0t1fs/linux_kernel/m0t1fs.h" /* m0t1fs_inode */
43 #include "m0t1fs/linux_kernel/fsync.h" /* m0t1fs_fsync_interactions */
44 #include "lib/misc.h" /* M0_SET0() */
45 #include "reqh/reqh_service.h" /* m0_reqh_service_txid */
46 /* declared in fsync.c */
47 extern struct m0t1fs_fsync_interactions fi;
48 
49 /* counters to indicate how many times each sub is/was called */
50 static int ut_kernel_fsync_count = 0;
51 static int ut_post_rpc_count = 0;
52 static int ut_wait_for_reply_count = 0;
53 static int ut_fop_fini_count = 0;
54 
55 /* values for control the behaviour of stub functions */
56 static int ut_post_rpc_delay = 0;
57 static int ut_kernel_fsync_return = -EINVAL;
58 static int ut_post_rpc_early_return = -EINVAL;
59 static int ut_post_rpc_return = -EINVAL;
60 static int ut_wait_for_reply_return = -EINVAL;
62 
63 /* The reply fop, set in ut_wait_for_reply */
64 static struct m0_fop reply_fop;
65 
66 /* The reply data */
68 
69 /* The fake records that need fsycning */
70 #define NUM_STRECORDS 10
72 
73 /* copy of the fsync interactions -
74  * used to restore the original function pointers */
76 
77 /* The fake file we try to fsync against */
78 static struct file file;
79 
80 /* The fake dentry for the file we fsync against */
81 static struct dentry dentry;
82 
83 /* The fake super_block for the file system we fsync against */
84 static struct super_block super_block;
85 
86 /* A fake m0inode for our fake file/dentry */
87 static struct m0t1fs_inode m0inode;
88 
89 /* A fake super_block for our fake filesystem */
90 static struct m0t1fs_sb csb;
91 
92 /* A fake serivce context for fsync to send rpc to */
94 
95 /* fake connection complying with m0_rpc_session_validate() */
96 struct m0_rpc_conn conn = { .c_rpc_machine = (void*)1 };
97 
98 /* Stub functions used to test m0t1fs_fsync */
99 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
100 static int ut_kernel_fsync(struct file *file, loff_t start, loff_t end,
101  int datasync)
102 #else
103 static int ut_kernel_fsync(struct file *file, struct dentry *dentry,
104  int datasync)
105 #endif
106 {
108 
109  return ut_kernel_fsync_return;
110 }
111 
112 static int ut_post_rpc(struct m0_rpc_item *item)
113 {
115 
116  /* Check this item came in with the 'right' session */
118 
119  /* After a certain point, change our return value */
122  else
123  return ut_post_rpc_return;
124 }
125 
127 {
128  struct m0_fop *request_fop;
129  struct m0_fop_fsync *request_data;
130 
132 
133  /* fop/reply are dealt with serially, so we can use the same object
134  * as a reply every time */
136 
137  /* Make sure we received a valid reply */
138  M0_ASSERT(item != NULL);
139  request_fop = m0_rpc_item_to_fop(item);
140  M0_ASSERT(request_fop != NULL);
141  request_data = m0_fop_data(request_fop);
142  M0_UT_ASSERT(request_data != NULL);
144  reply_data.ffr_be_remid = request_data->ff_be_remid;
145 
147 
149 }
150 
156 static void ut_fop_fini(struct m0_fop *fop)
157 {
159 
160  if (fop->f_data.fd_data != &reply_data && fop->f_data.fd_data != NULL)
162  fop->f_data.fd_data = NULL;
163 }
164 
168 static void ut_reset_stub_counters(void)
169 {
171  ut_post_rpc_count = 0;
173  ut_fop_fini_count = 0;
174 
175  /* Ensure early/late behaviour does nothing for ut_post_rpc */
176  ut_post_rpc_delay = 0;
177 }
178 
184 static void fake_fs_setup(void)
185 {
186  int i = 0;
187 
188  M0_SET0(&file);
189  M0_SET0(&dentry);
190  M0_SET0(&m0inode);
192  M0_SET0(&csb);
193  M0_SET0(&service);
194  M0_SET0(&stx);
195 
196  /* Assemble the file so that m0t1fs_fsync believes it */
197 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
198  file.f_path.dentry = &dentry;
199 #else
200  file.f_dentry = &dentry;
201 #endif
202  dentry.d_inode = &m0inode.ci_inode;
203  super_block.s_fs_info = &csb;
204  m0inode.ci_inode.i_sb = &super_block;
205 
206  m0_mutex_init(&m0inode.ci_pending_tx_lock);
207  ispti_tlist_init(&m0inode.ci_pending_tx);
208 
210  service.sc_type = M0_CST_IOS;
213 
214  /* Add some records that need fsyncing
215  * This creates @10 records, all for the same service that need
216  * syncing. This would never happen in reality.
217  * m0t1fs_fsync_record_update will only ever update the first service it
218  * finds, assuming that there are no duplicates.
219  */
220  for (i = 0; i < NUM_STRECORDS; i++) {
221  m0_tlink_init(&ispti_tl, &stx[i]);
222  stx[i].stx_tri.tri_txid = 3;
223  stx[i].stx_tri.tri_locality = 7;
225  ispti_tlist_add(&m0inode.ci_pending_tx, &stx[i]);
226  }
227 }
228 
229 
234 {
235  int rv;
236  struct m0t1fs_fsync_fop_wrapper *ffw;
237  struct m0_reqh_service_txid stx;
238  struct m0_fop_fsync *ffd;
239 
240  fake_fs_setup();
241 
242  M0_SET0(&stx);
243  M0_SET0(&copy);
244 
245  /* Copy the fsync_interactions struct so that we can restore it to
246  * default values later */
247  copy = fi;
248 
249  /* we need to override post rpc and fop_fini */
253 
254  /* Test the values get packed into the fop correctly */
256  ut_post_rpc_return = 0;
258  stx.stx_tri.tri_txid = 4000ULL;
259  stx.stx_tri.tri_locality = 11;
261  M0_UT_ASSERT(rv == 0);
262  ffd = m0_fop_data(&ffw->ffw_fop);
263  M0_UT_ASSERT(ffd != NULL);
268 
269  /* reset anything that got initalised */
270  m0_fop_fini(&ffw->ffw_fop);
271  m0_free(ffw);
272  M0_SET0(&stx);
273 
274  /* cause post_rpc to fail */
276  ut_post_rpc_return = -EINVAL;
278  stx.stx_tri.tri_txid = 4000ULL;
279  stx.stx_tri.tri_locality = 99;
283 
284  /* Restore the fsync_interactions struct */
285  fi = copy;
286 }
287 
288 int default_txid = 42;
290 
291 void
293  struct m0_reqh_service_txid *stx)
294 {
295  struct m0_fop_fsync *ffd;
296 
297  /* Initialise the fops */
299  m0_fop_data_alloc(&ffw->ffw_fop);
300  ffd = m0_fop_data(&ffw->ffw_fop);
301  M0_UT_ASSERT(ffd != NULL);
308  reply_data.ffr_rc = 0;
311  ffw->ffw_stx = stx;
312 }
313 
314 
315 void
316 call_m0t1fs_fsync_reply_process(struct m0t1fs_sb *input_csb,
317  struct m0t1fs_inode *input_m0inode,
318  struct m0t1fs_fsync_fop_wrapper *input_ffw,
319  int expect_return,
320  int expect_ut_wait_for_reply_count,
321  int expect_ut_fop_fini_count,
322  uint64_t expect_txid,
323  size_t expect_locality)
324 {
325  int rv;
326 
327  rv = m0t1fs_fsync_reply_process(input_csb, input_m0inode, input_ffw);
328  M0_UT_ASSERT(rv == expect_return);
329  M0_UT_ASSERT(ut_wait_for_reply_count == expect_ut_wait_for_reply_count);
330  M0_UT_ASSERT(ut_fop_fini_count == expect_ut_fop_fini_count);
331  M0_UT_ASSERT(input_ffw->ffw_stx->stx_tri.tri_txid == expect_txid);
333  expect_locality);
334 }
335 
340 {
341  struct m0_reqh_service_txid *iter;
342  struct m0t1fs_fsync_fop_wrapper ffw;
343  struct m0_reqh_service_txid stx;
344  struct m0_fop_fsync *ffd;
345 
346  fake_fs_setup();
347 
348  M0_SET0(&ffw);
349  M0_SET0(&stx);
350  M0_SET0(&ffd);
351  M0_SET0(&copy);
352 
353  /* Copy the fsync_interactions struct so that we can restore it to
354  * default values later */
355  copy = fi;
356 
357  /* we need to override wait for reply and fop_fini */
361 
362  /* Initialise the fops */
364 
365  /* wait for reply fails */
367  ut_wait_for_reply_return = -EINVAL;
372 
373  /* remote fop fails */
381 
382  /* inode:transaction-to-sync increased while fop was in flight */
383  /* super block record should still be updated - this can happen
384  * when the inode has been updated, and we raced to get the super_block
385  * lock before the thread updating the inode */
387  ffd = m0_fop_data(&ffw.ffw_fop);
388  M0_UT_ASSERT(ffd != NULL);
389  ffd->ff_be_remid.tri_txid = 42;
390  stx.stx_tri.tri_txid = 50;
392  reply_data.ffr_rc = 0;
395  iter = &service.sc_max_pending_tx;
396  iter->stx_tri.tri_txid = 42;
402  1, 1, 50, 2);
403  /* Check superblock record was updated */
405  iter = &service.sc_max_pending_tx;
406  M0_UT_ASSERT(iter->stx_tri.tri_txid == 0);
407  M0_UT_ASSERT(iter->stx_tri.tri_locality == 0);
409 
410  /* super-block:transaction-to-sync increased while fop was in flight */
411  /* inode record should still be updated - this can happen
412  * when another file was modified */
414  ffd = m0_fop_data(&ffw.ffw_fop);
415  M0_UT_ASSERT(ffd != NULL);
416  ffd->ff_be_remid.tri_txid = 42;
417  stx.stx_tri.tri_txid = 42;
419  reply_data.ffr_rc = 0;
422  iter = &service.sc_max_pending_tx;
423  iter->stx_tri.tri_txid = 50;
424  iter->stx_tri.tri_locality = 81;
430  1, 1, 0, 0);
431  /* Check superblock record was not updated */
433  iter = &service.sc_max_pending_tx;
434  M0_UT_ASSERT(iter->stx_tri.tri_txid != 0);
435  M0_UT_ASSERT(iter->stx_tri.tri_locality != 0);
437 
438  /* transaction-to-sync set to 0 on success */
440  ffd = m0_fop_data(&ffw.ffw_fop);
441  M0_UT_ASSERT(ffd != NULL);
442  ffd->ff_be_remid.tri_txid = 42;
443  stx.stx_tri.tri_txid = 42;
444  stx.stx_tri.tri_locality = 12;
445  reply_data.ffr_rc = 0;
448  iter = &service.sc_max_pending_tx;
449  iter->stx_tri.tri_txid = 42;
450  iter->stx_tri.tri_locality = 12;
452 
457  1, 1, 0, 0);
458  /* Check superblock record was updated */
460  iter = &service.sc_max_pending_tx;
461  M0_UT_ASSERT(iter->stx_tri.tri_txid == 0);
462  M0_UT_ASSERT(iter->stx_tri.tri_locality == 0);
464 
465  /* Restore the fsync_interactions struct */
466  fi = copy;
467 }
468 
469 
474 {
475  struct m0_reqh_service_txid *iter;
476  struct m0_be_tx_remid btr;
477 
478  fake_fs_setup();
479 
480  /* test the inode record is updated */
481  btr.tri_txid = 50;
482  btr.tri_locality = 3;
484  /* test the first record was updated */
485  M0_UT_ASSERT(stx[NUM_STRECORDS-1].stx_tri.tri_txid == 50ULL);
486  /* check later records were not updated */
487  M0_UT_ASSERT(stx[0].stx_tri.tri_txid != 50ULL);
488  M0_UT_ASSERT(stx[0].stx_tri.tri_locality != 3);
489 
490  /* test the sb record is updated */
492  iter = &service.sc_max_pending_tx;
494  btr.tri_txid = 999;
495  btr.tri_locality = 18;
497  M0_UT_ASSERT(iter->stx_tri.tri_txid == 999ULL);
498  M0_UT_ASSERT(iter->stx_tri.tri_locality == 18);
499 }
500 
501 void call_m0t1fs_fsync_core(struct m0t1fs_inode *input_m0inode,
502  int input_flag, int expect_return,
503  int expect_ut_post_rpc_count,
504  int expect_ut_wait_for_reply_count,
505  int expect_ut_fop_fini_count)
506 {
507  int rv;
508 
509  rv = m0t1fs_fsync_core(input_m0inode, input_flag);
510  M0_UT_ASSERT(rv == expect_return);
511  M0_UT_ASSERT(ut_post_rpc_count == expect_ut_post_rpc_count);
512  M0_UT_ASSERT(ut_wait_for_reply_count == expect_ut_wait_for_reply_count);
513  M0_UT_ASSERT(ut_fop_fini_count == expect_ut_fop_fini_count);
514 }
515 
519 static void test_m0t1fs_fsync_core(void)
520 {
521  int i;
522 
523  fake_fs_setup();
524 
525  M0_SET0(&reply_fop);
527  M0_SET0(&copy);
528 
529  /* Copy the fsync_interactions struct so that we can restore it to
530  * default values later */
531  copy = fi;
532 
533  /* Load the stubs over the top of the fsync_interactions struct */
538 
539  /* Cause fop sending to fail at the first attempt - check an error
540  * is returned and that we don't wait for a reply to the failed fop */
542  ut_post_rpc_return = -EINVAL;
543  ut_post_rpc_early_return = -EINVAL;
545  ut_post_rpc_return, 1, 0,1);
546 
547  /* Cause fop sending to fail after a few have been sent - check those
548  * that were sent correctly have their replies processed */
551  ut_post_rpc_delay = 4;
552  ut_post_rpc_return = -EINVAL;
558  /* reset replies */
559  for (i = 0; i < NUM_STRECORDS; i++)
560  stx[i].stx_tri.tri_txid = 3;
561 
562  /* Cause a remote fop to fail - test the error is propogated */
565  ut_post_rpc_delay = 2;
566  ut_post_rpc_return = 0;
572  /* reset replies */
573  for (i = 0; i < NUM_STRECORDS; i++)
574  stx[i].stx_tri.tri_txid = 3;
575 
576  /* Send replies for the versions requested - test records are updated
577  so that repeated calls to fsync have no effect */
579  ut_post_rpc_return = 0;
584  /* test the records were updated */
585  for (i = 0; i < NUM_STRECORDS; i++)
586  M0_UT_ASSERT(stx[i].stx_tri.tri_txid == 0);
587 
588  /* Don't reset replies ! */
589 
590  /* Test a repeated call to fsync causes no fops to be sent */
592  ut_post_rpc_return = 0;
596 
597  /* Restore the fsync_interactions struct */
598  fi = copy;
599 
600 }
601 
602 
603 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
604 void call_m0t1fs_fsync(struct file *input_file, loff_t start, loff_t end,
605  int input_datamode, int expect_return,
606  int expect_ut_kernel_fsync_count,
607  int expect_ut_post_rpc_count,
608  int expect_ut_fop_fini_count)
609 #else
610 void call_m0t1fs_fsync(struct file *input_file, struct dentry *input_dentry,
611  int input_datamode, int expect_return,
612  int expect_ut_kernel_fsync_count,
613  int expect_ut_post_rpc_count,
614  int expect_ut_fop_fini_count)
615 #endif
616 {
617  int rv;
618 
619 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
620  rv = m0t1fs_fsync(input_file, start, end, input_datamode);
621 #else
622  rv = m0t1fs_fsync(input_file, input_dentry, input_datamode);
623 #endif
624  M0_UT_ASSERT(rv == expect_return);
625  M0_UT_ASSERT(ut_kernel_fsync_count == expect_ut_kernel_fsync_count);
626  M0_UT_ASSERT(ut_post_rpc_count == expect_ut_post_rpc_count);
627  M0_UT_ASSERT(ut_fop_fini_count == expect_ut_fop_fini_count);
628 }
629 
630 void fsync_test(void)
631 {
632 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
633  /*
634  * fsync range in bytes, a whole file can be specified as [0, -1]
635  * see documentation of filemap_write_and_wait_range() in kernel
636  */
637  loff_t start = 0;
638  loff_t end = -1;
639 #endif
640  int i;
641 
642  /* test our component pieces work first */
647 
648  M0_SET0(&copy);
649 
650  /* Copy the fsync_interactions struct so that we can restore it to
651  * default values later */
652  copy = fi;
653 
654  fake_fs_setup();
660 
661  /* Cause kernel simple_fsync to fail - check an error is
662  * returned and that no fops are sent */
664  ut_kernel_fsync_return = -EIO;
665 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
666  call_m0t1fs_fsync(&file, start, end, 0, ut_kernel_fsync_return, 1, 0, 0);
667 #else
669 #endif
670  /* Check normal operation works */
673  ut_post_rpc_return = 0;
676 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
677  call_m0t1fs_fsync(&file, start, end, 0, 0, 1, NUM_STRECORDS,
678  NUM_STRECORDS);
679 #else
681  NUM_STRECORDS);
682 #endif
683  /* test the records were updated */
684  for (i = 0; i < NUM_STRECORDS; i++)
685  M0_UT_ASSERT(stx[i].stx_tri.tri_txid == 0);
686 
687  /* Restore the fsync_interactions struct */
688  fi = copy;
689 }
void * fd_data
Definition: fop.h:75
static struct m0_reqh_service_txid stx[NUM_STRECORDS]
Definition: fsync.c:71
struct m0t1fs_fsync_interactions fi
Definition: fsync.c:55
void(* fop_put)(struct m0_fop *fop)
Definition: fsync.h:388
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
#define NUM_STRECORDS
Definition: fsync.c:70
#define NULL
Definition: misc.h:38
static int ut_post_rpc(struct m0_rpc_item *item)
Definition: fsync.c:112
struct m0_mutex sc_max_pending_tx_lock
Definition: reqh_service.h:773
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
Definition: fop.c:79
uint64_t m0_time_t
Definition: time.h:37
int(* post_rpc)(struct m0_rpc_item *item)
Definition: fsync.h:385
int default_locality
Definition: fsync.c:289
static int ut_fop_fini_count
Definition: fsync.c:53
static struct file file
Definition: fsync.c:78
static struct m0t1fs_fsync_interactions copy
Definition: fsync.c:75
static int ut_kernel_fsync(struct file *file, loff_t start, loff_t end, int datasync)
Definition: fsync.c:100
static struct m0t1fs_sb csb
Definition: fsync.c:90
static int ut_wait_for_reply(struct m0_rpc_item *item, m0_time_t timeout)
Definition: fsync.c:126
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
M0_INTERNAL void m0_xcode_free_obj(struct m0_xcode_obj *obj)
Definition: xcode.c:248
int default_txid
Definition: fsync.c:288
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
void test_m0t1fs_fsync_record_update(void)
Definition: fsync.c:473
int32_t ffr_rc
Definition: fsync_fops.h:64
static int ut_post_rpc_delay
Definition: fsync.c:56
struct m0_fop_type m0_fop_fsync_mds_fopt
Definition: fsync_fops.c:33
static struct m0_rpc_item * item
Definition: item.c:56
static int ut_post_rpc_early_return
Definition: fsync.c:58
static void ut_fop_fini(struct m0_fop *fop)
Definition: fsync.c:156
static void test_m0t1fs_fsync_request_create(void)
Definition: fsync.c:233
static struct m0t1fs_inode m0inode
Definition: fsync.c:87
int i
Definition: dir.c:1033
struct m0_rpc_machine * c_rpc_machine
Definition: conn.h:278
void fsync_test(void)
Definition: fsync.c:630
static int ut_wait_for_reply_remote_return
Definition: fsync.c:61
#define M0_ASSERT(cond)
struct m0_be_tx_remid stx_tri
Definition: reqh_service.h:739
struct m0_be_tx_remid ffr_be_remid
Definition: fsync_fops.h:70
static struct m0_fop reply_fop
Definition: fsync.c:64
int m0t1fs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
Definition: fsync.c:354
struct m0_reqh_service_ctx * stx_service_ctx
Definition: reqh_service.h:733
enum m0_conf_service_type sc_type
Definition: reqh_service.h:757
struct m0_rpc_item * ri_reply
Definition: item.h:163
static struct m0_fop_fsync_rep reply_data
Definition: fsync.c:67
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
void call_m0t1fs_fsync_reply_process(struct m0t1fs_sb *input_csb, struct m0t1fs_inode *input_m0inode, struct m0t1fs_fsync_fop_wrapper *input_ffw, int expect_return, int expect_ut_wait_for_reply_count, int expect_ut_fop_fini_count, uint64_t expect_txid, size_t expect_locality)
Definition: fsync.c:316
static struct super_block super_block
Definition: fsync.c:84
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
Definition: fop.c:71
struct m0_rpc_conn conn
Definition: fsync.c:96
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
Definition: fop.c:136
M0_INTERNAL void m0_tlink_init(const struct m0_tl_descr *d, void *obj)
Definition: tlist.c:63
uint64_t tri_txid
Definition: tx.h:431
static struct m0_reqh_service_ctx service
Definition: fsync.c:93
uint64_t tri_locality
Definition: tx.h:432
struct m0_sm s_sm
Definition: session.h:325
static struct dentry dentry
Definition: fsync.c:81
static int ut_post_rpc_return
Definition: fsync.c:59
static uint32_t timeout
Definition: console.c:52
static int ut_kernel_fsync_return
Definition: fsync.c:57
struct m0_fop_data f_data
Definition: fop.h:82
static int ut_wait_for_reply_return
Definition: fsync.c:60
void call_m0t1fs_fsync_core(struct m0t1fs_inode *input_m0inode, int input_flag, int expect_return, int expect_ut_post_rpc_count, int expect_ut_wait_for_reply_count, int expect_ut_fop_fini_count)
Definition: fsync.c:501
static int ut_post_rpc_count
Definition: fsync.c:51
void(* fop_fini)(struct m0_fop *fop)
Definition: fsync.h:387
void test_m0t1fs_fsync_reply_process_init(struct m0t1fs_fsync_fop_wrapper *ffw, struct m0_reqh_service_txid *stx)
Definition: fsync.c:292
static int ut_wait_for_reply_count
Definition: fsync.c:52
void call_m0t1fs_fsync(struct file *input_file, loff_t start, loff_t end, int input_datamode, int expect_return, int expect_ut_kernel_fsync_count, int expect_ut_post_rpc_count, int expect_ut_fop_fini_count)
Definition: fsync.c:604
int m0t1fs_fsync_request_create(struct m0_reqh_service_txid *stx, struct m0t1fs_fsync_fop_wrapper **ffw_out, enum m0_fsync_mode mode)
Definition: fsync.c:105
M0_INTERNAL void m0_fop_release(struct m0_ref *ref)
Definition: fop.c:148
struct m0_be_tx_remid ff_be_remid
Definition: fsync_fops.h:48
static void test_m0t1fs_fsync_core(void)
Definition: fsync.c:519
struct m0_rpc_session * ri_session
Definition: item.h:147
static void fake_fs_setup(void)
Definition: fsync.c:184
int(* kernel_fsync)(struct file *file, loff_t start, loff_t end, int datasync)
Definition: fsync.h:379
static int start(struct m0_fom *fom)
Definition: trigger_fom.c:321
static struct m0_fop * fop
Definition: item.c:57
void test_m0t1fs_fsync_reply_process(void)
Definition: fsync.c:339
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
Definition: fop.c:346
struct m0_reqh_service_txid * ffw_stx
Definition: fsync.h:366
static void ut_reset_stub_counters(void)
Definition: fsync.c:168
uint32_t ff_fsync_mode
Definition: fsync_fops.h:51
struct m0_fop ffw_fop
Definition: fsync.h:358
struct m0_rpc_link sc_rlink
Definition: reqh_service.h:759
#define M0_FOP_XCODE_OBJ(f)
Definition: fop.h:334
void m0_free(void *data)
Definition: memory.c:146
static int ut_kernel_fsync_count
Definition: fsync.c:50
struct m0_rpc_item f_item
Definition: fop.h:83
uint32_t sm_state
Definition: sm.h:307
struct m0_rpc_conn * s_conn
Definition: session.h:312
#define M0_UT_ASSERT(a)
Definition: ut.h:46
struct m0_reqh_service_txid sc_max_pending_tx
Definition: reqh_service.h:772
Definition: fop.h:79
void m0t1fs_fsync_record_update(struct m0_reqh_service_ctx *service, struct m0t1fs_sb *csb, struct m0t1fs_inode *inode, struct m0_be_tx_remid *btr)
Definition: fsync.c:397
int m0t1fs_fsync_reply_process(struct m0t1fs_sb *csb, struct m0t1fs_inode *inode, struct m0t1fs_fsync_fop_wrapper *ffw)
Definition: fsync.c:206
int(* wait_for_reply)(struct m0_rpc_item *item, m0_time_t timeout)
Definition: fsync.h:386
int m0t1fs_fsync_core(struct m0t1fs_inode *inode, enum m0_fsync_mode mode)
Definition: fsync.c:281