[Linux1394-cvslog] rev 860 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-04-10 15:06:53
|
Author: bencollins Date: 2003-04-10 11:06:12 -0400 (Thu, 10 Apr 2003) New Revision: 860 Modified: trunk/nodemgr.c Log: Patch from Jim Radford to keep from building up long delays from busreset storms. Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c 2003-04-10 11:06:13.000000000 -0400 @@ -1570,28 +1570,26 @@ while (!down_interruptible(&hi->reset_sem) && !down_interruptible(&nodemgr_serialize)) { unsigned int generation; + int i; - /* Many resets can happen while we are waiting below. - * Make sure we respond only to the most recent one. */ - do { - /* Pause for 1/4 second, to make sure things - * settle down. If schedule_timeout returns - * non-zero, it means we caught a signal and that - * we should exit. */ + /* Pause for 1/4 second, to make sure things settle down. */ + for (i = HZ/4; i > 0; i-= HZ/16) { set_current_state(TASK_INTERRUPTIBLE); - if (schedule_timeout (HZ/4)) { - up(&nodemgr_serialize); + if (schedule_timeout(HZ/16)) goto caught_signal; - } - /* Now get the generation in which the node ID's - * we collect are valid. During the bus scan we - * will use this generation for the read - * transactions, so that if another reset occurs - * during the scan the transactions will fail - * instead of returning bogus data. */ + /* Now get the generation in which the node ID's we collect + * are valid. During the bus scan we will use this generation + * for the read transactions, so that if another reset occurs + * during the scan the transactions will fail instead of + * returning bogus data. */ generation = get_hpsb_generation(hi->host); - } while (!down_trylock(&hi->reset_sem)); + + /* If we get a reset before we are done waiting, then + * start the the waiting over again */ + while (!down_trylock(&hi->reset_sem)) + i = HZ/4; + } if (!nodemgr_check_root_capability(host)) { /* Do nothing, we are resetting */ |