Commit a324e6d0 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

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: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I880d289cdf957d4513c080efdcb7a5d8c6b3b447
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/775


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent a123ac27
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -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);