assert((io_u->flags & IO_U_F_FLIGHT) == 0);
io_u_set(td, io_u, IO_U_F_FLIGHT);
- if (td->o.serialize_overlap && td->o.io_submit_mode == IO_MODE_OFFLOAD)
+
+ /*
+ * If overlap checking was enabled in offload mode we
+ * can release this lock that was acquired when we
+ * started the overlap check because the IO_U_F_FLIGHT
+ * flag is now set
+ */
+ if (td_offload_overlap(td))
pthread_mutex_unlock(&overlap_check);
assert(fio_file_open(io_u->file));