Bug 121796
Summary: | [PATCH] wtd_down bugfix on IA64 | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 2.1 | Reporter: | Van Okamura <van.okamura> |
Component: | kernel | Assignee: | Jason Baron <jbaron> |
Status: | CLOSED ERRATA | QA Contact: | Brian Brock <bbrock> |
Severity: | high | Docs Contact: | |
Priority: | medium | ||
Version: | 2.1 | CC: | knoel, riel |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | ia64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-08-18 14:41:46 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 116726 |
Description
Van Okamura
2004-04-27 21:36:29 UTC
--- linux-2.4.18-e.43/arch/ia64/kernel/semaphore.c.orig 2004-04-23 17:04:49.000000000-0700 +++ linux-2.4.18-e.43/arch/ia64/kernel/semaphore.c 2004-04-23 17:09:23.000000000-0700 @@ -46,6 +46,7 @@ __up (struct semaphore *sem) static spinlock_t semaphore_lock = SPIN_LOCK_UNLOCKED; void __wtd_down(struct semaphore * sem, struct worktodo *wtd); +void __wtd_down_from_wakeup(struct semaphore * sem, struct worktodo *wtd); void __wtd_down_action(void *data) { @@ -55,7 +56,7 @@ void __wtd_down_action(void *data) wtd_pop(wtd); sem = wtd->data; - __wtd_down(sem, wtd); + __wtd_down_from_wakeup(sem, wtd); } void __wtd_down_waiter(wait_queue_t *wait) @@ -93,6 +94,33 @@ void __wtd_down(struct semaphore * sem, } } +/* + * Same as __wtd_down, but sem->sleepers is not incremented when coming from a wakeup. + */ +void __wtd_down_from_wakeup(struct semaphore * sem, struct worktodo *wtd) +{ + int gotit; + int sleepers; + + init_waitqueue_func_entry(&wtd->wait, __wtd_down_waiter); + wtd->data = sem; + + spin_lock_irq(&semaphore_lock); + sleepers = sem->sleepers; + gotit = add_wait_queue_exclusive_cond(&sem->wait, &wtd->wait, + atomic_add_negative(sleepers - 1, &sem->count)); + if (gotit) + sem->sleepers = 0; + else + sem->sleepers = 1; + spin_unlock_irq(&semaphore_lock); + + if (gotit) { + wake_up(&sem->wait); + wtd_queue(wtd); + } +} + /* Returns 0 if we acquired the semaphore, 1 if it was queued. */ int wtd_down(struct worktodo *wtd, struct semaphore *sem) { this is in U5 for ia64, changing to modified. An errata has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2004-327.html |