ut/blob: issue to consecutive md syncs

Expands blob_simultaneous_operations to cover case
when second md sync is perfomed without waiting for the first
one to complete.

The blob state is forced in UT, but in normal usage could be
changed by modifying xattr, allocating thin clusters or other.

Related to #1170

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I880d289cdf957d4513c080efdcb7a5d8c6b3b447
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/775
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2020-02-11 08:05:07 -05:00
parent a123ac277e
commit a324e6d001

View File

@ -7630,6 +7630,32 @@ blob_simultaneous_operations(void)
/* Blob resized successfully */
CU_ASSERT(g_bserrno == 0);
/* Issue two consecutive blob syncs, neither should fail.
* Force sync to actually occur by marking blob dirty each time.
* Execution of sync should not be enough to complete the operation,
* since disk I/O is required to complete it. */
g_bserrno = -1;
blob->state = SPDK_BLOB_STATE_DIRTY;
spdk_blob_sync_md(blob, blob_op_complete, NULL);
SPDK_CU_ASSERT_FATAL(g_bserrno == -1);
blob->state = SPDK_BLOB_STATE_DIRTY;
spdk_blob_sync_md(blob, blob_op_complete, NULL);
SPDK_CU_ASSERT_FATAL(g_bserrno == -1);
uint32_t completions = 0;
while (completions < 2) {
SPDK_CU_ASSERT_FATAL(poll_thread_times(0, 1));
if (g_bserrno == 0) {
g_bserrno = -1;
completions++;
}
/* Never should the g_bserrno be other than -1.
* It would mean that either of syncs failed. */
SPDK_CU_ASSERT_FATAL(g_bserrno == -1);
}
spdk_blob_close(blob, blob_op_complete, NULL);
poll_threads();
CU_ASSERT(g_bserrno == 0);