NTSTATUS smbd_do_unlocking(struct smb_request *req,
			   files_struct *fsp,
			   uint16_t num_ulocks,
			   struct smbd_lock_element *ulocks)
{
	struct smbd_do_unlocking_state state = {
		.fsp = fsp,
		.num_ulocks = num_ulocks,
		.ulocks = ulocks,
	};
	NTSTATUS status;

	DBG_NOTICE("%s num_ulocks=%"PRIu16"\n", fsp_fnum_dbg(fsp), num_ulocks);

	status = share_mode_do_locked(
		fsp->file_id, smbd_do_unlocking_fn, &state);

	if (!NT_STATUS_IS_OK(status)) {
		DBG_DEBUG("share_mode_do_locked failed: %s\n",
			  nt_errstr(status));
		return status;
	}
	if (!NT_STATUS_IS_OK(state.status)) {
		DBG_DEBUG("smbd_do_unlocking_fn failed: %s\n",
			  nt_errstr(status));
		return state.status;
	}

	return NT_STATUS_OK;
}
NTSTATUS smbd_do_unlocking(struct smb_request *req,
			   files_struct *fsp,
			   uint16_t num_ulocks,
			   struct smbd_lock_element *ulocks)
{
	struct smbd_do_unlocking_state state = {
		.fsp = fsp,
		.num_ulocks = num_ulocks,
		.ulocks = ulocks,
	};
	NTSTATUS status;

	DBG_NOTICE("%s num_ulocks=%"PRIu16"\n", fsp_fnum_dbg(fsp), num_ulocks);

	status = share_mode_do_locked(
		fsp->file_id, smbd_do_unlocking_fn, &state);

	if (!NT_STATUS_IS_OK(status)) {
		DBG_DEBUG("share_mode_do_locked failed: %s\n",
			  nt_errstr(status));
		return status;
	}
	if (!NT_STATUS_IS_OK(state.status)) {
		DBG_DEBUG("smbd_do_unlocking_fn failed: %s\n",
			  nt_errstr(status));
		return state.status;
	}

	return NT_STATUS_OK;
}