From faa429fb7e7beff9c32452f4ee16c93be0e8624a Mon Sep 17 00:00:00 2001 From: John Winans Date: Mon, 2 May 1994 11:10:50 +0000 Subject: [PATCH] Changed order of the callback and semGive in the WdTask. There was a race condition --- src/drv/drvBitBus.c | 12 +++++++----- src/drv/drvPEPBitBus.c | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/drv/drvBitBus.c b/src/drv/drvBitBus.c index 190714917..5faf4d416 100644 --- a/src/drv/drvBitBus.c +++ b/src/drv/drvBitBus.c @@ -809,20 +809,22 @@ int link; (plink->deviceStatus[pnode->txMsg.node])--; /* fix device status */ pnode->status = BB_TIMEOUT; - /* Release a completion lock if one was spec'd */ - if (pnode->psyncSem != NULL) - semGive(*(pnode->psyncSem)); - + /* Do now in case we need it later */ + resetNodeData = pnode->txMsg.node; /* mark the node number */ + /* Make the callbackRequest if one was spec'd */ if(pnode->finishProc != NULL) callbackRequest(pnode); /* schedule completion processing */ + /* Release a completion lock if one was spec'd */ + if (pnode->psyncSem != NULL) + semGive(*(pnode->psyncSem)); + /* If we are not going to reboot the link... */ if (plink->nukeEm == 0) { /* Send out a RAC_NODE_OFFLINE to the controller */ semGive(plink->busyList.sem); - resetNodeData = pnode->txMsg.node; /* mark the node number */ printf("issuing a node offline for link %d node %d\n", link, resetNodeData); semTake(plink->queue[BB_Q_HIGH].sem, WAIT_FOREVER); diff --git a/src/drv/drvPEPBitBus.c b/src/drv/drvPEPBitBus.c index bea3a4b6c..717138e94 100644 --- a/src/drv/drvPEPBitBus.c +++ b/src/drv/drvPEPBitBus.c @@ -823,14 +823,24 @@ int link; (plink->deviceStatus[pnode->txMsg.node])--; /* fix device status */ pnode->status = BB_TIMEOUT; + /* Gotta do this now in case we need the info after the completion */ + resetNode.txMsg.node = pnode->txMsg.node; + offlnNodeData = pnode->txMsg.node; /* mark the node number */ + + /* Make the callbackRequest if one was spec'd */ + if(pnode->finishProc != NULL) + { + if (bbDebug>2) + { + printf("xvmeWdTask(%d): invoking the callbackRequest %8.8x %d\n", link, pnode->finishProc, pnode->priority); + } + callbackRequest(pnode); /* schedule completion processing */ + } + /* Release a completion lock if one was spec'd */ if (pnode->psyncSem != NULL && plink->nukeEm == 0) semGive(*(pnode->psyncSem)); - /* Make the callbackRequest if one was spec'd */ - if(pnode->finishProc != NULL) - callbackRequest(pnode); /* schedule completion processing */ - /* If we are not going to reboot the link... */ if ( plink->nukeEm == 0 ) { /* Send out a RAC_RESET/RAC_OFFLINE pair */ @@ -838,11 +848,9 @@ int link; /* Configure message for a RAC_RESET */ resetNode.txMsg.cmd = 0x00; - resetNode.txMsg.node = pnode->txMsg.node; /* Configure message for a RAC_OFFLINE */ offlnNode.txMsg.cmd = RAC_OFFLINE; - offlnNodeData = pnode->txMsg.node; /* mark the node number */ offlnNode.txMsg.node = 0xff; /* Queue the messages (high priority, reset first) */