From f2b96a27f85cccf99659486d021f22281f2b0a76 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Tue, 22 Aug 2023 18:36:15 +0900 Subject: [PATCH] Revert "fw_fcp: abort transaction at bus reset" This reverts commit 71d595376d7c2e9a90b38ddfd6bd8bceedfe9670 since Linux FireWire subsystem does not gurantee the order of events for bus reset and asynchronous request subaction. It is likely to operate the asynchronous request subaction wrongly due to generation of bus topology different from the generation cached in user space. Signed-off-by: Takashi Sakamoto --- src/fw_fcp.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/fw_fcp.c b/src/fw_fcp.c index fc72d411..027806f5 100644 --- a/src/fw_fcp.c +++ b/src/fw_fcp.c @@ -82,7 +82,6 @@ LIST_HEAD(waiter_entries, waiter); typedef struct { HinawaFwNode *node; - gulong bus_update_handler_id; guint card_id; struct waiter_entries transactions; @@ -422,6 +421,7 @@ gboolean hinawa_fw_fcp_avc_transaction_with_tstamp(HinawaFwFcp *self, } deferred: while (w.state == WAITER_STATE_PENDING) { + // NOTE: Timeout at bus-reset, illegally. if (!g_cond_wait_until(&w.cond, &w.mutex, expiration)) break; } @@ -613,8 +613,7 @@ static HinawaFwRcode handle_requested_signal(HinawaFwResp *resp, HinawaFwTcode t NULL); if (current.generation != record.generation) node_history_insert_record(&priv->history, ¤t); - - recorded = node_history_detect_record(&priv->history, &record); + recorded = !memcmp(&record, ¤t, sizeof(record)); } node_history_unlock(&priv->history); @@ -631,30 +630,6 @@ static HinawaFwRcode handle_requested_signal(HinawaFwResp *resp, HinawaFwTcode t return HINAWA_FW_RCODE_COMPLETE; } -static void handle_bus_update_signal(HinawaFwNode *node, HinawaFwFcp *self) -{ - HinawaFwFcpPrivate *priv = hinawa_fw_fcp_get_instance_private(self); - struct waiter *w; - struct node_record record; - - g_mutex_lock(&priv->transactions_mutex); - - LIST_FOREACH(w, &priv->transactions, list) { - g_mutex_lock(&w->mutex); - w->state = WAITER_STATE_ABORTED; - g_cond_signal(&w->cond); - g_mutex_unlock(&w->mutex); - } - - g_mutex_unlock(&priv->transactions_mutex); - - g_object_get(node, "generation", &record.generation, "node-id", &record.src_node_id, NULL); - - node_history_lock(&priv->history); - node_history_insert_record(&priv->history, &record); - node_history_unlock(&priv->history); -} - /** * hinawa_fw_fcp_bind: * @self: A [class@FwFcp]. @@ -698,9 +673,6 @@ gboolean hinawa_fw_fcp_bind(HinawaFwFcp *self, HinawaFwNode *node, GError **erro node_history_insert_record(&priv->history, &record); node_history_unlock(&priv->history); - priv->bus_update_handler_id = - g_signal_connect(node, "bus-update", - G_CALLBACK(handle_bus_update_signal), self); priv->node = g_object_ref(node); } @@ -725,7 +697,6 @@ void hinawa_fw_fcp_unbind(HinawaFwFcp *self) if (priv->node != NULL) { hinawa_fw_resp_release(HINAWA_FW_RESP(self)); - g_signal_handler_disconnect(priv->node, priv->bus_update_handler_id); g_object_unref(priv->node); priv->node = NULL;