diff --git a/src/libpmemobj/tx.c b/src/libpmemobj/tx.c
index 5aa44c26c5d02994b5f981444a5d73bc15bee797..5fa489f0b0f7d8550d4b9ff7386e1fd6ad84809e 100644
--- a/src/libpmemobj/tx.c
+++ b/src/libpmemobj/tx.c
@@ -1096,9 +1096,26 @@ pmemobj_tx_add_snapshot(struct tx *tx, struct tx_range_def *snapshot)
 		ULOG_OPERATION_BUF_CPY);
 }
 
+/*
+ * pmemobj_tx_merge_flags -- (internal) common code for merging flags between
+ * two ranges to ensure resultant behavior is correct
+ */
+static void
+pmemobj_tx_merge_flags(struct tx_range_def *dest, struct tx_range_def *merged)
+{
+	/*
+	 * POBJ_XADD_NO_FLUSH should only be set in merged range if set in
+	 * both ranges
+	 */
+	if ((dest->flags & POBJ_XADD_NO_FLUSH) &&
+				!(merged->flags & POBJ_XADD_NO_FLUSH)) {
+		dest->flags = dest->flags & (~POBJ_XADD_NO_FLUSH);
+	}
+}
+
 /*
  * pmemobj_tx_add_common -- (internal) common code for adding persistent memory
- *				into the transaction
+ * into the transaction
  */
 static int
 pmemobj_tx_add_common(struct tx *tx, struct tx_range_def *args)
@@ -1204,6 +1221,7 @@ pmemobj_tx_add_common(struct tx *tx, struct tx_range_def *args)
 			size_t intersection = fend - MAX(f->offset, r.offset);
 			r.size -= intersection + snapshot.size;
 			f->size += snapshot.size;
+			pmemobj_tx_merge_flags(f, args);
 
 			if (snapshot.size != 0) {
 				ret = pmemobj_tx_add_snapshot(tx, &snapshot);
@@ -1219,6 +1237,7 @@ pmemobj_tx_add_common(struct tx *tx, struct tx_range_def *args)
 				struct tx_range_def *fprev = ravl_data(nprev);
 				ASSERTeq(rend, fprev->offset);
 				f->size += fprev->size;
+				pmemobj_tx_merge_flags(f, fprev);
 				ravl_remove(tx->ranges, nprev);
 			}
 		} else if (fend >= r.offset) {
@@ -1242,6 +1261,7 @@ pmemobj_tx_add_common(struct tx *tx, struct tx_range_def *args)
 			 */
 			size_t overlap = rend - MAX(f->offset, r.offset);
 			r.size -= overlap;
+			pmemobj_tx_merge_flags(f, args);
 		} else {
 			ASSERT(0);
 		}
@@ -1662,7 +1682,7 @@ pmemobj_tx_free(PMEMoid oid)
 	if (n != NULL) {
 		VEC_FOREACH_BY_PTR(action, &tx->actions) {
 			if (action->type == POBJ_ACTION_TYPE_HEAP &&
-			    action->heap.offset == oid.off) {
+				action->heap.offset == oid.off) {
 				struct tx_range_def *r = ravl_data(n);
 				void *ptr = OBJ_OFF_TO_PTR(pop, r->offset);
 				VALGRIND_SET_CLEAN(ptr, r->size);
diff --git a/src/test/common_badblock.sh b/src/test/common_badblock.sh
index a5357430e9583311a04549e7c1c189a3c639e0c0..abb72ee9c3ae9f01c6ceac8e904633913bc87228 100644
--- a/src/test/common_badblock.sh
+++ b/src/test/common_badblock.sh
@@ -72,17 +72,15 @@ function badblock_test_init() {
 		usage "bad device type: $1"
 		;;
 	esac
+	DEVTYPE=$1
 
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		ndctl_nfit_test_init
-	else
-		echo "Invalid BADBLOCK_TEST_TYPE value: "$BADBLOCK_TEST_TYPE"" &>> $PREP_LOG_FILE
-		exit 1
 	fi
 
-	if [ "$1" == "dax_device" ]; then
+	if [ "$DEVTYPE" == "dax_device" ]; then
 		DEVICE=$(badblock_test_get_dax_device)
-	elif [ "$1" == "block_device" ]; then
+	elif [ "$DEVTYPE" == "block_device" ]; then
 		DEVICE=$(badblock_test_get_block_device)
 		prepare_mount_dir $DEVICE $2
 	fi
@@ -97,7 +95,8 @@ function badblock_test_init() {
 # Input arguments:
 # 1) remote node number
 # 2) device type (dax_device|block_device)
-# 3) mount directory (in case of block device type)
+# 3) for block device: mount directory
+#    for dax device on real pmem: dax device index on a given node
 #
 function badblock_test_init_node() {
 	case "$2"
@@ -108,17 +107,15 @@ function badblock_test_init_node() {
 		usage "bad device type: $2"
 		;;
 	esac
+	DEVTYPE=$2
 
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		ndctl_nfit_test_init_node $1
-	else
-		echo "Invalid BADBLOCK_TEST_TYPE value: "$BADBLOCK_TEST_TYPE"" &>> $PREP_LOG_FILE
-		exit 1
 	fi
 
-	if [ "$2" == "dax_device" ]; then
-		DEVICE=$(badblock_test_get_dax_device_node $1)
-	elif [ "$2" == "block_device" ]; then
+	if [ "$DEVTYPE" == "dax_device" ]; then
+		DEVICE=$(badblock_test_get_dax_device_node $1 $3)
+	elif [ "$DEVTYPE" == "block_device" ]; then
 		DEVICE=$(badblock_test_get_block_device_node $1)
 		prepare_mount_dir_node $1 $DEVICE $3
 	fi
@@ -133,6 +130,8 @@ function badblock_test_get_dax_device() {
 	DEVICE=""
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		DEVICE=$(ndctl_nfit_test_get_dax_device)
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		DEVICE=$(real_pmem_get_dax_device)
 	fi
 	echo $DEVICE
 }
@@ -140,11 +139,16 @@ function badblock_test_get_dax_device() {
 #
 # badblock_test_get_dax_device_node -- get name of the dax device on a given
 #                                      remote node
+# Input arguments:
+# 1) remote node number
+# 2) For real pmem: device dax index on a given node
 #
 function badblock_test_get_dax_device_node() {
 	DEVICE=""
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		DEVICE=$(ndctl_nfit_test_get_dax_device_node $1)
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		DEVICE=$(real_pmem_get_dax_device_node $1 $2)
 	fi
 	echo $DEVICE
 }
@@ -156,6 +160,8 @@ function badblock_test_get_block_device() {
 	DEVICE=""
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		DEVICE=$(ndctl_nfit_test_get_block_device)
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		DEVICE=$(real_pmem_get_block_device)
 	fi
 	echo "$DEVICE"
 }
@@ -168,6 +174,8 @@ function badblock_test_get_block_device_node() {
 	DEVICE=""
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		DEVICE=$(ndctl_nfit_test_get_block_device_node $1)
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		DEVICE=$(real_pmem_get_block_device_node $1)
 	fi
 	echo "$DEVICE"
 }
@@ -183,6 +191,10 @@ function prepare_mount_dir() {
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		local FULLDEV="/dev/$1"
 		ndctl_nfit_test_mount_pmem $FULLDEV $2
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		if [ ! -d $2 ]; then
+			mkdir -p $2
+		fi
 	fi
 }
 
@@ -199,7 +211,60 @@ function prepare_mount_dir_node() {
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		local FULLDEV="/dev/$2"
 		ndctl_nfit_test_mount_pmem_node $1 $FULLDEV $3
-    fi
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		if [ ! -d $3 ]; then
+			run_on_node $1 "mkdir -p $3"
+		fi
+	fi
+}
+
+
+#
+# real_pmem_get_dax_device -- get real pmem dax device name
+#
+function real_pmem_get_dax_device() {
+	local FULLDEV=${DEVICE_DAX_PATH[0]}
+	DEVICE=${FULLDEV##*/}
+	echo $DEVICE
+}
+
+#
+# real_pmem_get_dax_device_node -- get real pmem dax device name on a given
+#                                  remote node
+#
+# Input arguments:
+# 1) remote node number
+# 2) device dax index number
+#
+function real_pmem_get_dax_device_node() {
+	local node=$1
+	local devdax_index=$2
+
+	local device_dax_path=(${NODE_DEVICE_DAX_PATH[$node]})
+
+	local FULLDEV=${device_dax_path[$devdax_index]}
+
+	DEVICE=${FULLDEV##*/}
+	echo $DEVICE
+}
+
+#
+# real_pmem_get_block_device -- get real pmem block device name
+#
+function real_pmem_get_block_device() {
+	local FULL_DEV=$(mount | grep $PMEM_FS_DIR | cut -f 1 -d" ")
+	DEVICE=${FULL_DEV##*/}
+	echo $DEVICE
+}
+
+#
+# real_pmem_get_block_device_node -- get real pmem block device name on a given
+#                                    remote node
+#
+function real_pmem_get_block_device_node() {
+	local FULL_DEV=$(expect_normal_exit run_on_node $1 mount | grep $PMEM_FS_DIR | cut -f 1 -d" ")
+	DEVICE=${FULL_DEV##*/}
+	echo $DEVICE
 }
 
 #
@@ -246,6 +311,7 @@ function badblock_test_fini() {
 
 #
 # badblock_test_fini_node() -- clean badblock test based on underlying hardware
+#                              on a given remote node
 #
 # Input arguments:
 # 1) node number
@@ -498,22 +564,107 @@ function ndctl_get_namespace_of_device_node() {
 # 3) number of bad blocks
 #
 function ndctl_inject_error() {
-	local NAMESPACE=$1
-	local BLOCK=$2
-	local COUNT=$3
+	local namespace=$1
+	local block=$2
+	local count=$3
 
-	echo "# sudo ndctl inject-error --block=$BLOCK --count=$COUNT $NAMESPACE" >> $PREP_LOG_FILE
-	sudo ndctl inject-error --block=$BLOCK --count=$COUNT $NAMESPACE  &>> $PREP_LOG_FILE
+	echo "# sudo ndctl inject-error --block=$block --count=$count $namespace" >> $PREP_LOG_FILE
+	expect_normal_exit "sudo ndctl inject-error --block=$block --count=$count $namespace"  &>> $PREP_LOG_FILE
 
 	echo "# sudo ndctl start-scrub" >> $PREP_LOG_FILE
-	sudo ndctl start-scrub &>> $PREP_LOG_FILE
+	expect_normal_exit "sudo ndctl start-scrub" &>> $PREP_LOG_FILE
 
 	echo "# sudo ndctl wait-scrub" >> $PREP_LOG_FILE
-	sudo ndctl wait-scrub &>> $PREP_LOG_FILE
+	expect_normal_exit "sudo ndctl wait-scrub" &>> $PREP_LOG_FILE
 
 	echo "(done: ndctl wait-scrub)" >> $PREP_LOG_FILE
 }
 
+#
+# ndctl_inject_error_node -- inject error (bad blocks) to the namespace on
+#                            a given remote node
+#
+# Input arguments:
+# 1) node
+# 2) namespace
+# 3) the first bad block
+# 4) number of bad blocks
+#
+function ndctl_inject_error_node() {
+	local node=$1
+	local namespace=$2
+	local block=$3
+	local count=$4
+
+	echo "# sudo ndctl inject-error --block=$block --count=$count $namespace" >> $PREP_LOG_FILE
+	expect_normal_exit run_on_node $node "sudo ndctl inject-error --block=$block --count=$count $namespace"  &>> $PREP_LOG_FILE
+
+	echo "# sudo ndctl start-scrub" >> $PREP_LOG_FILE
+	expect_normal_exit run_on_node $node "sudo ndctl start-scrub" &>> $PREP_LOG_FILE
+
+	echo "# sudo ndctl wait-scrub" >> $PREP_LOG_FILE
+	expect_normal_exit run_on_node $node "sudo ndctl wait-scrub" &>> $PREP_LOG_FILE
+
+	echo "(done: ndctl wait-scrub)" >> $PREP_LOG_FILE
+}
+
+#
+# ndctl_uninject_error -- clear bad block error present in the namespace
+#
+# Input arguments:
+# 1) full device name (error clearing process requires writing to device)
+# 2) namespace
+# 3) the first bad block
+# 4) number of bad blocks
+#
+function ndctl_uninject_error() {
+	# explicit uninjection is not required on nfit_test since any error
+	# injections made during the tests are eventually cleaned up in _fini
+	# function by reloading the whole namespace
+	if [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		local fulldev=$1
+		local namespace=$2
+		local block=$3
+		local count=$4
+		expect_normal_exit "sudo ndctl inject-error --uninject --block=$block --count=$count $namespace &>/dev/null"
+		if [ "$DEVTYPE" == "block_device" ]; then
+			expect_normal_exit "sudo dd if=/dev/zero of="$fulldev" bs=512 seek="$block" count="$count" oflag=direct &>/dev/null"
+		elif [ "$DEVTYPE" == "dax_device" ]; then
+			expect_normal_exit "$DAXIO$EXESUFFIX -i /dev/zero -o "$fulldev" -s "$block" -l "$count" &>/dev/null"
+		fi
+	fi
+}
+
+#
+# ndctl_uninject_error_node -- clear bad block error present in the
+#                              namespace on a given remote node
+#
+# Input arguments:
+# 1) node
+# 2) full device name (error clearing process requires writing to device)
+# 3) namespace
+# 4) the first bad block
+# 5) number of bad blocks
+#
+function ndctl_uninject_error_node() {
+	# explicit uninjection is not required on nfit_test since any error
+	# injections made during the tests are eventually cleaned up in _fini
+	# function by reloading the whole namespace
+	if [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		local node=$1
+		local fulldev=$2
+		local namespace=$3
+		local block=$4
+		local count=$5
+		expect_normal_exit run_on_node $node "sudo ndctl inject-error --uninject --block=$block --count=$count $namespace &>/dev/null"
+		if [ "$DEVTYPE" == "block_device" ]; then
+			expect_normal_exit run_on_node $node "sudo dd if=/dev/zero of="$fulldev" bs=512 seek="$block" count="$count" oflag=direct &>/dev/null"
+		elif [ "$DEVTYPE" == "dax_device" ]; then
+			expect_normal_exit run_on_node $node "$DAXIO$EXESUFFIX -i /dev/zero -o "$fulldev" -s "$block" -l "$count" &>/dev/null"
+		fi
+	fi
+}
+
 #
 # print_bad_blocks -- print all bad blocks (count, offset and length)
 #                     or "No bad blocks found" if there are no bad blocks
diff --git a/src/test/obj_tx_add_range/obj_tx_add_range.c b/src/test/obj_tx_add_range/obj_tx_add_range.c
index 39c3f3eef0db36578b38a2f0afae11e652713f35..3a15519984b07011d796b6881c4911bd94ceec80 100644
--- a/src/test/obj_tx_add_range/obj_tx_add_range.c
+++ b/src/test/obj_tx_add_range/obj_tx_add_range.c
@@ -918,6 +918,87 @@ do_tx_add_range_overlapping(PMEMobjpool *pop)
 	UT_ASSERT(util_is_zeroed(D_RO(obj)->data, OVERLAP_SIZE));
 }
 
+/*
+ * do_tx_add_range_flag_merge_right -- call pmemobj_tx_add_range with
+ * overlapping ranges, but different flags
+ */
+static void
+do_tx_add_range_flag_merge_right(PMEMobjpool *pop)
+{
+	TOID(struct overlap_object) obj;
+	TOID_ASSIGN(obj, do_tx_zalloc(pop, 1));
+
+	/*
+	 * ++++--------
+	 * --++++++++--
+	 */
+	TX_BEGIN(pop) {
+		pmemobj_tx_xadd_range(obj.oid, 0, 4, POBJ_XADD_NO_FLUSH);
+		memset(D_RW(obj)->data, 1, 4);
+
+		pmemobj_tx_add_range(obj.oid, 2, 8);
+		memset(D_RW(obj)->data + 2, 3, 8);
+
+	} TX_ONABORT {
+		UT_ASSERT(0);
+	} TX_END
+}
+
+/*
+ * do_tx_add_range_flag_merge_left -- call pmemobj_tx_add_range with
+ * overlapping ranges, but different flags
+ */
+static void
+do_tx_add_range_flag_merge_left(PMEMobjpool *pop)
+{
+	TOID(struct overlap_object) obj;
+	TOID_ASSIGN(obj, do_tx_zalloc(pop, 1));
+
+	/*
+	 * --------++++
+	 * --++++++++--
+	 */
+	TX_BEGIN(pop) {
+		pmemobj_tx_xadd_range(obj.oid, 8, 4, POBJ_XADD_NO_FLUSH);
+		memset(D_RW(obj)->data + 8, 2, 4);
+
+		pmemobj_tx_add_range(obj.oid, 2, 8);
+		memset(D_RW(obj)->data + 2, 3, 8);
+
+	} TX_ONABORT {
+		UT_ASSERT(0);
+	} TX_END
+}
+
+/*
+ * do_tx_add_range_flag_merge_middle -- call pmemobj_tx_add_range with
+ * three adjacent ranges, but different flags
+ */
+static void
+do_tx_add_range_flag_merge_middle(PMEMobjpool *pop)
+{
+	TOID(struct overlap_object) obj;
+	TOID_ASSIGN(obj, do_tx_zalloc(pop, 1));
+
+	/*
+	 * ++++----++++
+	 * ----++++----
+	 */
+	TX_BEGIN(pop) {
+		pmemobj_tx_xadd_range(obj.oid, 0, 4, POBJ_XADD_NO_FLUSH);
+		memset(D_RW(obj)->data, 1, 4);
+
+		pmemobj_tx_xadd_range(obj.oid, 8, 4, POBJ_XADD_NO_FLUSH);
+		memset(D_RW(obj)->data + 8, 2, 4);
+
+		pmemobj_tx_add_range(obj.oid, 4, 4);
+		memset(D_RW(obj)->data + 4, 3, 4);
+
+	} TX_ONABORT {
+		UT_ASSERT(0);
+	} TX_END
+}
+
 /*
  * do_tx_add_range_reopen -- check for persistent memory leak in undo log set
  */
@@ -1045,6 +1126,12 @@ main(int argc, char *argv[])
 		VALGRIND_WRITE_STATS;
 		do_tx_add_range_no_uninit_check_commit_no_flag(pop);
 		VALGRIND_WRITE_STATS;
+		do_tx_add_range_flag_merge_left(pop);
+		VALGRIND_WRITE_STATS;
+		do_tx_add_range_flag_merge_right(pop);
+		VALGRIND_WRITE_STATS;
+		do_tx_add_range_flag_merge_middle(pop);
+		VALGRIND_WRITE_STATS;
 		do_tx_xadd_range_no_flush_commit(pop);
 		pmemobj_close(pop);
 	}
diff --git a/src/test/obj_tx_add_range/pmemcheck1.log.match b/src/test/obj_tx_add_range/pmemcheck1.log.match
index 597a66ed4aba33792e7973e44aeda5779b3be356..e5c7d36885b2b9c9da801ce1adf52695ff38b1a9 100644
--- a/src/test/obj_tx_add_range/pmemcheck1.log.match
+++ b/src/test/obj_tx_add_range/pmemcheck1.log.match
@@ -73,6 +73,15 @@
 ==$(*)== Number of stores not made persistent: 0
 ==$(*)== ERROR SUMMARY: 0 errors
 ==$(*)== 
+==$(*)== Number of stores not made persistent: 0
+==$(*)== ERROR SUMMARY: 0 errors
+==$(*)== 
+==$(*)== Number of stores not made persistent: 0
+==$(*)== ERROR SUMMARY: 0 errors
+==$(*)== 
+==$(*)== Number of stores not made persistent: 0
+==$(*)== ERROR SUMMARY: 0 errors
+==$(*)== 
 ==$(*)== 
 ==$(*)== Number of stores not made persistent: 1
 ==$(*)== Stores not made persistent properly:
diff --git a/src/test/pmempool_check/TEST31 b/src/test/pmempool_check/TEST31
index 700328e1e59df24a0e1466e0dc5b3915f12c4975..a50e82261854a03a941edf37366d1c95feac4f68 100755
--- a/src/test/pmempool_check/TEST31
+++ b/src/test/pmempool_check/TEST31
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -81,6 +80,8 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_bad_blocks
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
+
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_check/TEST32 b/src/test/pmempool_check/TEST32
index a385129e6e5d28d7a0778b7688779e9ce1418398..8992c12c8b50b39e28ebd2fd97ea70cb74a59667 100755
--- a/src/test/pmempool_check/TEST32
+++ b/src/test/pmempool_check/TEST32
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -79,6 +78,8 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_bad_blocks
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 11 1
+
 badblock_test_fini
 
 check
diff --git a/src/test/pmempool_create/TEST10 b/src/test/pmempool_create/TEST10
index a71ad786e84eeb71cb57a947ad7e70d8a8045243..4f83b75e9d9b80f3307ebc31dbf9b4a0f7186b7e 100755
--- a/src/test/pmempool_create/TEST10
+++ b/src/test/pmempool_create/TEST10
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -69,6 +68,7 @@ expect_bad_blocks
 #
 expect_normal_exit "$PMEMPOOL$EXESUFFIX create obj --layout pmempool$SUFFIX $POOLSET &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 11 1
 badblock_test_fini
 
 check
diff --git a/src/test/pmempool_create/TEST11 b/src/test/pmempool_create/TEST11
index 600c19bf04365672178c53c94682f42ddbee4dd2..425eaab21a4560a5c97d1677f47c21c1b939879a 100755
--- a/src/test/pmempool_create/TEST11
+++ b/src/test/pmempool_create/TEST11
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -75,6 +74,7 @@ expect_bad_blocks
 #
 expect_normal_exit "$PMEMPOOL$EXESUFFIX create obj --layout pmempool$SUFFIX $POOLSET &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_create/TEST12 b/src/test/pmempool_create/TEST12
index 410af86cdc7150b7ae96489fa18b568280ae9d32..e40c0414c029fb57f6c22b2ca773fa85bd9f0a47 100755
--- a/src/test/pmempool_create/TEST12
+++ b/src/test/pmempool_create/TEST12
@@ -39,10 +39,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -66,6 +65,7 @@ expect_bad_blocks
 
 expect_normal_exit "$PMEMPOOL$EXESUFFIX create obj -b --layout pmempool$SUFFIX $POOLSET >> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 11 1
 badblock_test_fini
 
 check
diff --git a/src/test/pmempool_info/TEST24 b/src/test/pmempool_info/TEST24
index 8d9c761a02a980f404f2a52e98801be7080a22fc..01cfc70e2e10048986bff93a53fc779a896250bf 100755
--- a/src/test/pmempool_info/TEST24
+++ b/src/test/pmempool_info/TEST24
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
diff --git a/src/test/pmempool_info/TEST25 b/src/test/pmempool_info/TEST25
index 7d4add47891c8649ac909ac6142d96afec3e1d83..10822d452bb0d9dfd9d8a70edda2924fa39b77f4 100755
--- a/src/test/pmempool_info/TEST25
+++ b/src/test/pmempool_info/TEST25
@@ -38,10 +38,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -68,6 +67,7 @@ expect_bad_blocks
 
 expect_normal_exit $PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST27 b/src/test/pmempool_sync/TEST27
index 651bd9c160ab0c63d376bd7037741e56005a8afa..d94e15fa8c97712f68171271701bbb466712327d 100755
--- a/src/test/pmempool_sync/TEST27
+++ b/src/test/pmempool_sync/TEST27
@@ -39,10 +39,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -90,6 +89,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST28 b/src/test/pmempool_sync/TEST28
index 2d3bfcdd793897442e795bc0ded3e34d0a73fe9f..1abf2034317e99a8c3978d0e87edc62ff87088f8 100755
--- a/src/test/pmempool_sync/TEST28
+++ b/src/test/pmempool_sync/TEST28
@@ -39,10 +39,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -93,6 +92,7 @@ print_bad_blocks
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 0 1
 badblock_test_fini
 
 check
diff --git a/src/test/pmempool_sync/TEST30 b/src/test/pmempool_sync/TEST30
index 00e27099aa6f6f6ccbf5dbc1ffee0b4333c35353..dd796b9663d2a447350e322fc56cafba961e13d6 100755
--- a/src/test/pmempool_sync/TEST30
+++ b/src/test/pmempool_sync/TEST30
@@ -39,10 +39,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -90,6 +89,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST31 b/src/test/pmempool_sync/TEST31
index 7b0865ae5ae9e1aa864123fc2ccf27370393ad16..182c7e65a2bb577133481fe5c20e68764d4863e1 100755
--- a/src/test/pmempool_sync/TEST31
+++ b/src/test/pmempool_sync/TEST31
@@ -39,10 +39,9 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -93,6 +92,8 @@ print_bad_blocks
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 1000 1
+
 badblock_test_fini
 
 check
diff --git a/src/test/pmempool_sync/TEST38 b/src/test/pmempool_sync/TEST38
index b498d577d9fa530c7278ca78350d0751957d11a8..26bbaeb09f32caea2dd1e3027b56342684b66dcd 100755
--- a/src/test/pmempool_sync/TEST38
+++ b/src/test/pmempool_sync/TEST38
@@ -44,7 +44,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
 # must be non-static debug release of the binary because the test relies on the
 # gdb ability to interrupt the program at a static method inside
@@ -52,7 +51,7 @@ require_fs_type non-pmem
 require_build_type debug
 require_command gdb
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -110,6 +109,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST39 b/src/test/pmempool_sync/TEST39
index 0db401c48f123fb1607d39000dad30cb35d3abe4..6ec7d6d217fa8a13391e7d0bf916eedefd2c6d96 100755
--- a/src/test/pmempool_sync/TEST39
+++ b/src/test/pmempool_sync/TEST39
@@ -44,7 +44,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
 # must be non-static debug release of the binary because the test relies on the
 # gdb ability to interrupt the program at a static method inside
@@ -52,7 +51,7 @@ require_fs_type non-pmem
 require_build_type debug
 require_command gdb
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -110,6 +109,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST40 b/src/test/pmempool_sync/TEST40
index cce34939019c2ec2ff138edb2d5093ecceb35120..f064c15b3978c6817a3fc2fb3c7cecea7248b4cf 100755
--- a/src/test/pmempool_sync/TEST40
+++ b/src/test/pmempool_sync/TEST40
@@ -44,7 +44,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
 # must be non-static debug release of the binary because the test relies on the
 # gdb ability to interrupt the program at a static method inside
@@ -52,7 +51,7 @@ require_fs_type non-pmem
 require_build_type debug
 require_command gdb
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -110,6 +109,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync/TEST41 b/src/test/pmempool_sync/TEST41
index 27660865e0f32d4f00978b8b67aebc347d8b0b7f..7c79cd673540f5665ace0fd8fd82635316eb80d2 100755
--- a/src/test/pmempool_sync/TEST41
+++ b/src/test/pmempool_sync/TEST41
@@ -44,7 +44,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
 # must be non-static debug release of the binary because the test relies on the
 # gdb ability to interrupt the program at a static method inside
@@ -52,7 +51,7 @@ require_fs_type non-pmem
 require_build_type debug
 require_command gdb
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
 setup
@@ -110,6 +109,7 @@ expect_normal_exit "$PMEMPOOL$EXESUFFIX info --bad-blocks=yes $POOLSET >> $LOG"
 
 expect_normal_exit "$OBJ_VERIFY$EXESUFFIX $POOLSET pmempool$SUFFIX v &>> $LOG"
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/pmempool_sync_remote/TEST22 b/src/test/pmempool_sync_remote/TEST22
index 56b786d7f3d1cff3e17dff6b9ff69bf5be6adc79..2ae64ed82926d0fa9e45c9092e8f433d8b5c105a 100755
--- a/src/test/pmempool_sync_remote/TEST22
+++ b/src/test/pmempool_sync_remote/TEST22
@@ -104,10 +104,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 # inject bad block:
 FILE=${MOUNT_DIR}/pool.local
 FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 0)
-
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 0
 
@@ -118,6 +115,7 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST23 b/src/test/pmempool_sync_remote/TEST23
index 58b0f11e1cc6b7b0d3545db17c5c0d72eb6dfb19..e773d00e55b5d2dfc2ed3f22c794a8c6b7cdf493 100755
--- a/src/test/pmempool_sync_remote/TEST23
+++ b/src/test/pmempool_sync_remote/TEST23
@@ -104,10 +104,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 # inject bad block:
 FILE=${MOUNT_DIR}/pool.local
 FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 1000)
-
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 0
 
@@ -118,6 +115,7 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST24 b/src/test/pmempool_sync_remote/TEST24
index 19a219e5744fc447cfb245b16e750c7dc853ce2f..b5193266b11e9093257861fc3329118697e9f23e 100755
--- a/src/test/pmempool_sync_remote/TEST24
+++ b/src/test/pmempool_sync_remote/TEST24
@@ -109,9 +109,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 FILE=${MOUNT_DIR}/pool.local.part.1
 FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 0)
 
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 0
 
@@ -122,6 +120,7 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST25 b/src/test/pmempool_sync_remote/TEST25
index 52bd9eb75a64c64d1ae154de27d83e275deeae7a..28d6ab615feb45ef17b5da4ea147a591d73203d6 100755
--- a/src/test/pmempool_sync_remote/TEST25
+++ b/src/test/pmempool_sync_remote/TEST25
@@ -108,9 +108,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 FILE=${MOUNT_DIR}/pool.local.part.1
 FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 1000)
 
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 0
 
@@ -121,6 +119,7 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST32 b/src/test/pmempool_sync_remote/TEST32
index 4b2b99198767cf1a980791a5c46935735b3bc4a4..88379b03f4bb98eae8942e72f7ffd37b9444f80a 100755
--- a/src/test/pmempool_sync_remote/TEST32
+++ b/src/test/pmempool_sync_remote/TEST32
@@ -111,17 +111,14 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 ###############################################################################
 
 # inject bad block in the part #0
-FILE=${MOUNT_DIR}/pool.local.part.0
-FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 0)
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
+FILE_0=${MOUNT_DIR}/pool.local.part.0
+FIRST_SECTOR_0=$(expect_normal_exit run_on_node 0 ../extents $FILE_0 -l 0)
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR_0 1
 
 # inject bad block in the part #1
-FILE=${MOUNT_DIR}/pool.local.part.1
-FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 0)
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+FILE_1=${MOUNT_DIR}/pool.local.part.1
+FIRST_SECTOR_1=$(expect_normal_exit run_on_node 0 ../extents $FILE_1 -l 0)
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR_1 1
 
 expect_bad_blocks_node 0
 
@@ -132,6 +129,8 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR_0 1
+ndctl_uninject_error_node 0 $FULLDEV $NAMESPACE $FIRST_SECTOR_1 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST33 b/src/test/pmempool_sync_remote/TEST33
index 31216890428a8a76c6aa0014c3c7bcb1c73cf907..a8adf9e2e73132646d305d8275e7ec1728817e66 100755
--- a/src/test/pmempool_sync_remote/TEST33
+++ b/src/test/pmempool_sync_remote/TEST33
@@ -111,17 +111,14 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 ###############################################################################
 
 # inject bad block in the part #0
-FILE=${MOUNT_DIR}/pool.local.part.0
-FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 1000)
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
+FILE_0=${MOUNT_DIR}/pool.local.part.0
+FIRST_SECTOR_0=$(expect_normal_exit run_on_node 0 ../extents $FILE_0 -l 1000)
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR_0 1
 
 # inject bad block in the part #1
-FILE=${MOUNT_DIR}/pool.local.part.1
-FIRST_SECTOR=$(expect_normal_exit run_on_node 0 ../extents $FILE -l 1000)
-expect_normal_exit run_on_node 0 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-
-expect_normal_exit run_on_node 0 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 0 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+FILE_1=${MOUNT_DIR}/pool.local.part.1
+FIRST_SECTOR_1=$(expect_normal_exit run_on_node 0 ../extents $FILE_1 -l 1000)
+ndctl_inject_error_node 0 $NAMESPACE $FIRST_SECTOR_1 1
 
 expect_bad_blocks_node 0
 
@@ -132,6 +129,8 @@ expect_bad_blocks_node 0
 expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}$POOLSET_LOCAL &>> $LOG"
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 0 $NAMESPACE $FIRST_SECTOR_0 1
+ndctl_uninject_error_node 0 $NAMESPACE $FIRST_SECTOR_1 1
 badblock_test_fini_node 0 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST34 b/src/test/pmempool_sync_remote/TEST34
index f078d48864ad5a6ec234f9dbd2bab9f623e55c58..e5a7b6cab22a162b2631a66de715942047bec4ee 100755
--- a/src/test/pmempool_sync_remote/TEST34
+++ b/src/test/pmempool_sync_remote/TEST34
@@ -40,7 +40,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
@@ -109,9 +108,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 FILE=$MOUNT_DIR/pool.remote
 FIRST_SECTOR=$(expect_normal_exit run_on_node 1 ../extents $FILE -l 0)
 
-expect_normal_exit run_on_node 1 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 1 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 1 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 1 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 1
 
@@ -126,6 +123,7 @@ expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}/$POOLSET
 # verification should succeed
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}/$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 1 $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 1 $MOUNT_DIR
 
 pass
diff --git a/src/test/pmempool_sync_remote/TEST35 b/src/test/pmempool_sync_remote/TEST35
index 982357db525aafc00f2ada11a9b19706a52f3f8c..2a2733cd529e61233bb49149560b4a41fb592dc9 100755
--- a/src/test/pmempool_sync_remote/TEST35
+++ b/src/test/pmempool_sync_remote/TEST35
@@ -40,7 +40,6 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 require_build_type debug nondebug
 require_linked_with_ndctl $PMEMPOOL$EXESUFFIX
 
@@ -109,9 +108,7 @@ turn_on_checking_bad_blocks_node 1 ${NODE_DIR[1]}/${POOLSET_REMOTE}
 FILE=$MOUNT_DIR/pool.remote
 FIRST_SECTOR=$(expect_normal_exit run_on_node 1 ../extents $FILE -l 1000)
 
-expect_normal_exit run_on_node 1 "sudo ndctl inject-error --block=$FIRST_SECTOR --count=1 $NAMESPACE &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 1 "sudo ndctl start-scrub &>> $PREP_LOG_FILE"
-expect_normal_exit run_on_node 1 "sudo ndctl wait-scrub &>> $PREP_LOG_FILE"
+ndctl_inject_error_node 1 $NAMESPACE $FIRST_SECTOR 1
 
 expect_bad_blocks_node 1
 
@@ -126,6 +123,7 @@ expect_normal_exit run_on_node 0 "../pmempool sync -b -v ${NODE_DIR[0]}/$POOLSET
 # verification should succeed
 expect_normal_exit run_on_node 0 "../obj_verify ${NODE_DIR[0]}/$POOLSET_LOCAL $LAYOUT v &>> $LOG"
 
+ndctl_uninject_error_node 1 $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini_node 1 $MOUNT_DIR
 
 pass
diff --git a/src/test/testconfig.sh.example b/src/test/testconfig.sh.example
index 32d96a1d081d1c04b8490e63a9d6c3f697830577..4f17066540f0b0c1566a51fdd5ec27a15fd14a8c 100644
--- a/src/test/testconfig.sh.example
+++ b/src/test/testconfig.sh.example
@@ -140,14 +140,18 @@ TM=1
 
 #
 # Enable and select the type of tests for code handling bad blocks.
-# Options: nfit_test, none (do not run, default)
+# Options: nfit_test, real_pmem, none (do not run, default).
 #
-# Running tests on emulated memory requires 'nfit_test' kernel module to be
-# present in the system: see https://github.com/pmem/ndctl#unit-tests
+# Running tests on emulated memory ('nfit test' option) requires 'nfit_test'
+# kernel module to be present in the system.
+# See https://github.com/pmem/ndctl#unit-tests
 #
-# The tests use 'sudo' command many times and insert the 'nfit_test'
-# kernel module, so they can be considered as POTENTIALLY DANGEROUS
-# and have to be explicitly enabled.
+# If the 'real_pmem' option is enabled, tests are run on real hardware
+# provided through PMEM_FS_DIR or DEVICE_DAX_PATH config fields.
+#
+# The tests use 'sudo' command many times and, in case of tests on
+# emulated memory, insert the 'nfit_test' kernel module, so they can be
+# considered as POTENTIALLY DANGEROUS and have to be explicitly enabled.
 # Enable them ONLY IF you are sure you know what you are doing.
 #
 # As of kernel 4.20, the nfit-test module causes kernel oops whenever a devdax
diff --git a/src/test/unittest/unittest.sh b/src/test/unittest/unittest.sh
index 49191f7cc6f48f2e210f4f6bcdd7e4d63fcc7b04..c9ff03a4a13a4b7745afefcc50e724a1b90b6c59 100644
--- a/src/test/unittest/unittest.sh
+++ b/src/test/unittest/unittest.sh
@@ -3596,12 +3596,40 @@ function require_max_devdax_size() {
 
 #
 # require_badblock_tests_enabled - check if tests for bad block support are not enabled
+# Input arguments:
+# 1) test device type
 #
 function require_badblock_tests_enabled() {
 	require_sudo_allowed
 	require_command ndctl
+
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
+
 		require_kernel_module nfit_test
+
+		# nfit_test dax device is created by the test and is
+		# used directly - no file system path nor device dax path
+		# needs to be provided by the user
+		if [ $1 == "dax_device" ]; then
+			require_fs_type none
+
+		# nfit_test block device is created by the test and mounted on
+		# a filesystem of any type provided by the user
+		elif [ $1 == "block_device" ]; then
+			require_fs_type any
+		fi
+
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+
+		if [ $1 == "dax_device" ]; then
+			require fs_type none
+			require_dax_devices 1
+			require_binary $DAXIO$EXESUFFIX
+
+		elif [ $1 == "block_device" ]; then
+			require_fs_type pmem
+		fi
+
 	else
 		msg "$UNITTEST_NAME: SKIP: bad block tests are not enabled in testconfig.sh"
 		exit 0
@@ -3617,6 +3645,8 @@ function require_badblock_tests_enabled_node() {
 	require_command_node $1 ndctl
 	if [ "$BADBLOCK_TEST_TYPE" == "nfit_test" ]; then
 		require_kernel_module_node $1 nfit_test
+	elif [ "$BADBLOCK_TEST_TYPE" == "real_pmem" ]; then
+		:
 	else
 		msg "$UNITTEST_NAME: SKIP: bad block tests are not enabled in testconfig.sh"
 		exit 0
diff --git a/src/test/util_badblock/TEST2 b/src/test/util_badblock/TEST2
index f82bc52ae6381166b30d4430845c64c754973013..6b3142402486a13e2dc830586a2046b0eebfa883 100755
--- a/src/test/util_badblock/TEST2
+++ b/src/test/util_badblock/TEST2
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
diff --git a/src/test/util_badblock/TEST3 b/src/test/util_badblock/TEST3
index 8584eaa22c7acc4f501b1ea47105208c7d388fe3..67a54adab8a928180b49197a68e1049008dba931 100755
--- a/src/test/util_badblock/TEST3
+++ b/src/test/util_badblock/TEST3
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type none
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
@@ -58,6 +57,8 @@ expect_bad_blocks
 
 expect_normal_exit ./util_badblock$EXESUFFIX $FULLDEV l
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 11 1
+
 badblock_test_fini
 
 check
diff --git a/src/test/util_badblock/TEST4 b/src/test/util_badblock/TEST4
index 94588c33995565eb9e4e93b011577f0cc9232512..b7c50ff3e56dab612302b262b44e7710fdded3f9 100755
--- a/src/test/util_badblock/TEST4
+++ b/src/test/util_badblock/TEST4
@@ -41,9 +41,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type none
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
diff --git a/src/test/util_badblock/TEST5 b/src/test/util_badblock/TEST5
index cb16288fcdf4fe7f28e75ce18280589ce4d8ff34..d213c3ec607a7507cf12ea3dcbedf1215428ea5d 100755
--- a/src/test/util_badblock/TEST5
+++ b/src/test/util_badblock/TEST5
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
diff --git a/src/test/util_badblock/TEST6 b/src/test/util_badblock/TEST6
index 7478430313ac20360ba46b09ef73ce008e7814ca..93c68e4bd16f45a7d487e6f8d56add7fb8c03b2b 100755
--- a/src/test/util_badblock/TEST6
+++ b/src/test/util_badblock/TEST6
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
@@ -63,6 +62,7 @@ expect_bad_blocks
 
 expect_normal_exit ./util_badblock$EXESUFFIX $FILE l
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/util_badblock/TEST7 b/src/test/util_badblock/TEST7
index 25a60527f1aa2da627dd0233983528df9aaf2c3a..2c1b7e833078e3b35997e44962cdcc452952e7d4 100755
--- a/src/test/util_badblock/TEST7
+++ b/src/test/util_badblock/TEST7
@@ -41,9 +41,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
diff --git a/src/test/util_badblock/TEST8 b/src/test/util_badblock/TEST8
index 36576723cc36d797435bf7b23aa877a7680d3785..03b47cf4fc8b5dd250eff077194722d54424df30 100755
--- a/src/test/util_badblock/TEST8
+++ b/src/test/util_badblock/TEST8
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled dax_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
@@ -64,6 +63,8 @@ expect_bad_blocks
 # open a pool with bad blocks
 expect_abnormal_exit ./util_badblock$EXESUFFIX $FULLDEV o
 
+ndctl_uninject_error $FULLDEV $NAMESPACE 11 1
+
 badblock_test_fini
 
 check
diff --git a/src/test/util_badblock/TEST9 b/src/test/util_badblock/TEST9
index e5bc0c5174c23fb11f1216ae2ba16752300d688f..fb07e60b03a17e8e5adf8d4e3ea452fd4bd6d786 100755
--- a/src/test/util_badblock/TEST9
+++ b/src/test/util_badblock/TEST9
@@ -40,9 +40,8 @@
 . ../unittest/unittest.sh
 
 require_test_type medium
-require_fs_type non-pmem
 
-require_badblock_tests_enabled
+require_badblock_tests_enabled block_device
 require_linked_with_ndctl ./util_badblock$EXESUFFIX
 
 setup
@@ -69,6 +68,7 @@ expect_bad_blocks
 # open a pool with bad blocks
 expect_abnormal_exit ./util_badblock$EXESUFFIX $FILE o
 
+ndctl_uninject_error $FULLDEV $NAMESPACE $FIRST_SECTOR 1
 badblock_test_fini $MOUNT_DIR
 
 check
diff --git a/src/test/util_badblock/util_badblock.c b/src/test/util_badblock/util_badblock.c
index 1308f0b657aabbc06109ce59b0914cfdb381e393..8a61698143bf98a0a3045e7852a8235613e83891 100644
--- a/src/test/util_badblock/util_badblock.c
+++ b/src/test/util_badblock/util_badblock.c
@@ -43,6 +43,7 @@
 #include "os_badblock.h"
 #include "badblock.h"
 #include "fault_injection.h"
+#include "file.h"
 
 #define MIN_POOL ((size_t)(1024 * 1024 * 8)) /* 8 MiB */
 #define MIN_PART ((size_t)(1024 * 1024 * 2)) /* 2 MiB */
@@ -72,6 +73,10 @@ do_list(const char *path)
 		goto exit_free;
 	}
 
+	int file_type = util_file_get_type(path);
+	if (file_type < 0)
+		UT_FATAL("!Cannot read type of the file");
+
 	UT_OUT("Found %u bad block(s):", bbs->bb_cnt);
 
 	unsigned b;
@@ -79,8 +84,14 @@ do_list(const char *path)
 		UT_OUT("%llu %u",
 			/* offset is printed in 512b sectors  */
 			bbs->bbv[b].offset >> 9,
-			/* length is printed in blocks */
-			bbs->bbv[b].length / (unsigned)st.st_blksize);
+			/*
+			 * length is printed in:
+			 * - 512b sectors in case of DAX devices,
+			 * - blocks in case of regular files.
+			 */
+			(file_type == TYPE_DEVDAX) ?
+				bbs->bbv[b].length >> 9 :
+				bbs->bbv[b].length / (unsigned)st.st_blksize);
 	}
 
 exit_free:
diff --git a/utils/docker/run-build.sh b/utils/docker/run-build.sh
index cb1c874313c0db0c42fc353eb2b2f7c543a24d78..6a26a065c42b2c17603e6813d7eab54032e78145 100755
--- a/utils/docker/run-build.sh
+++ b/utils/docker/run-build.sh
@@ -44,8 +44,8 @@ set -e
 cd $WORKDIR
 make check-license
 make cstyle
-make -j2 USE_LIBUNWIND=1
-make -j2 test USE_LIBUNWIND=1
+make -j2
+make -j2 test
 make -j2 pcheck TEST_BUILD=$TEST_BUILD
 make -j2 pycheck
 make DESTDIR=/tmp source
diff --git a/utils/docker/run-coverage.sh b/utils/docker/run-coverage.sh
index cece06abab5c1424b03d7fb6c2808f2eae7498aa..1c97880959dbfb88bba539802f7b27050a7f1eac 100755
--- a/utils/docker/run-coverage.sh
+++ b/utils/docker/run-coverage.sh
@@ -48,8 +48,8 @@ export UT_VALGRIND_SKIP_PRINT_MISMATCHED=1
 
 # Build all and run tests
 cd $WORKDIR
-make -j2 USE_LIBUNWIND=1 COVERAGE=1
-make -j2 test USE_LIBUNWIND=1 COVERAGE=1
+make -j2 COVERAGE=1
+make -j2 test COVERAGE=1
 
 # XXX: unfortunately valgrind raports issues in coverage instrumentation
 # which we have to ignore (-k flag), also there is dependency between